[Ocfs2-tools-devel] [PATCH 5/5] ocfs2-tools: add xattr support in mkfs.ocfs2

Coly Li coyli at suse.de
Fri Oct 24 02:58:05 PDT 2008



Tiger Yang Wrote:
> This patch add support for new feature xattr in mkfs.ocfs2.
> Xattr is an incompatible feature, need option --fs-features=xattr
> or --fs-feature-level=max-features to enable it.
> 
> Signed-off-by: Tiger Yang <tiger.yang at oracle.com>
> ---
>  libocfs2/feature_string.c  |   12 +++++++++++-
>  mkfs.ocfs2/mkfs.c          |    6 ++++++
>  mkfs.ocfs2/mkfs.ocfs2.8.in |    5 +++++
>  3 files changed, 22 insertions(+), 1 deletions(-)
> 
> diff --git a/libocfs2/feature_string.c b/libocfs2/feature_string.c
> index 7b1f93e..0aff8ad 100644
> --- a/libocfs2/feature_string.c
> +++ b/libocfs2/feature_string.c
> @@ -72,7 +72,8 @@ static ocfs2_fs_options feature_level_defaults[] = {
>  	{OCFS2_FEATURE_COMPAT_BACKUP_SB | OCFS2_FEATURE_COMPAT_JBD2_SB,
>  	 OCFS2_FEATURE_INCOMPAT_SPARSE_ALLOC |
>  	 OCFS2_FEATURE_INCOMPAT_EXTENDED_SLOT_MAP |
> -	 OCFS2_FEATURE_INCOMPAT_INLINE_DATA,
> +	 OCFS2_FEATURE_INCOMPAT_INLINE_DATA |
> +	 OCFS2_FEATURE_INCOMPAT_XATTR,
>  	 OCFS2_FEATURE_RO_COMPAT_UNWRITTEN}, /* OCFS2_FEATURE_LEVEL_MAX_FEATURES */
>  };
>  
> @@ -110,6 +111,11 @@ static struct fs_feature_flags ocfs2_supported_features[] = {
>  		{0, OCFS2_FEATURE_INCOMPAT_INLINE_DATA, 0},
>  	},
>  	{
> +		"xattr",
> +		{0, OCFS2_FEATURE_INCOMPAT_XATTR, 0},
> +		{0, OCFS2_FEATURE_INCOMPAT_XATTR, 0},
> +	},
> +	{
>  		NULL,
>  		{0, 0, 0},
>  		{0, 0, 0}
> @@ -169,6 +175,10 @@ static struct feature_name ocfs2_feature_names[] = {
>  		.fn_flag = {OCFS2_FEATURE_COMPAT_JBD2_SB, 0, 0},
>  	},
>  	{
> +		.fn_name = "Xattr",
I see "xattr" and "Xattr" in this apatch, should them be different ?


> +		.fn_flag = {0, OCFS2_FEATURE_INCOMPAT_XATTR, 0},
> +	},
> +	{
>  		.fn_name = NULL,
>  	},
>  };
> diff --git a/mkfs.ocfs2/mkfs.c b/mkfs.ocfs2/mkfs.c
> index aad166b..5e44fda 100644
> --- a/mkfs.ocfs2/mkfs.c
> +++ b/mkfs.ocfs2/mkfs.c
> @@ -1935,6 +1935,12 @@ format_superblock(State *s, SystemFileDiskRecord *rec,
>  	 */
>  	s->feature_flags.opt_compat &= ~OCFS2_FEATURE_COMPAT_BACKUP_SB;
>  
> +	if (s->feature_flags.opt_incompat & OCFS2_FEATURE_INCOMPAT_XATTR) {
> +		di->id2.i_super.s_xattr_inline_size =
> +						OCFS2_MIN_XATTR_INLINE_SIZE;
> +		di->id2.i_super.s_uuid_hash = xattr_uuid_hash(s->uuid);
> +	}
> +
>  	di->id2.i_super.s_feature_incompat = s->feature_flags.opt_incompat;
>  	di->id2.i_super.s_feature_compat = s->feature_flags.opt_compat;
>  	di->id2.i_super.s_feature_ro_compat = s->feature_flags.opt_ro_compat;
> diff --git a/mkfs.ocfs2/mkfs.ocfs2.8.in b/mkfs.ocfs2/mkfs.ocfs2.8.in
> index de43946..a2e6321 100644
> --- a/mkfs.ocfs2/mkfs.ocfs2.8.in
> +++ b/mkfs.ocfs2/mkfs.ocfs2.8.in
> @@ -126,6 +126,11 @@ Enable support for sparse files. With this, \fIOCFS2\fR can avoid allocating (an
>  \fBunwritten\fR
>  Enable unwritten extents support. With this turned on, an application can request that a range of clusters be pre-allocated within a file. \fIOCFS2\fR will mark those extents with a special flag so that expensive data zeroing doesn't have to be performed. Reads and writes to a pre-allocated region act as reads and writes to a hole, except a write will not fail due to lack of data allocation. This feature requires \fBsparse\fR file support to be turned on. Available with the file system bundled with Linux kernels 2.6.23 and later.
>  .RE
> +.RS 1.2i
> +.TP
> +\fBxattr\fR
> +Enable support for extended attribute.
> +.RE
>  
>  .TP
>  \fB\-\-fs\-feature\-level=\fR\fR\fIfeature\-level\fR

-- 
Coly Li
SuSE PRC Labs




More information about the Ocfs2-tools-devel mailing list