All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Fasheh <mfasheh@suse.com>
To: ocfs2-devel@oss.oracle.com
Subject: [Ocfs2-devel] [PATCH 05/15] Add xattr header in ocfs2. v3
Date: Sun, 10 Aug 2008 17:03:27 -0700	[thread overview]
Message-ID: <20080811000327.GD28014@wotan.suse.de> (raw)
In-Reply-To: <1218061894-7693-5-git-send-email-tao.ma@oracle.com>

On Thu, Aug 07, 2008 at 06:31:27AM +0800, Tao Ma wrote:
> Modification from V2 to V3:
> 1. Add annotations for every field.
> 2. Change csum to be _le64 include xb_csum and xh_csum.
> 3. Change the definition of xe_local and xe_type and add set/get helper
>    function for them.
> 
> Signed-off-by: Tao Ma <tao.ma@oracle.com>
> ---
>  fs/ocfs2/ocfs2_fs.h |  118 +++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 files changed, 118 insertions(+), 0 deletions(-)
> 
> diff --git a/fs/ocfs2/ocfs2_fs.h b/fs/ocfs2/ocfs2_fs.h
> index 3f19451..1b0e136 100644
> --- a/fs/ocfs2/ocfs2_fs.h
> +++ b/fs/ocfs2/ocfs2_fs.h
> @@ -64,6 +64,7 @@
>  #define OCFS2_INODE_SIGNATURE		"INODE01"
>  #define OCFS2_EXTENT_BLOCK_SIGNATURE	"EXBLK01"
>  #define OCFS2_GROUP_DESC_SIGNATURE      "GROUP01"
> +#define OCFS2_XATTR_BLOCK_SIGNATURE	"XATTR01"
>  
>  /* Compatibility flags */
>  #define OCFS2_HAS_COMPAT_FEATURE(sb,mask)			\
> @@ -712,6 +713,123 @@ struct ocfs2_group_desc
>  /*40*/	__u8    bg_bitmap[0];
>  };
>  
> +/*
> + * On disk extended attribute structure for OCFS2.
> + */
> +
> +/*
> + * ocfs2_xattr_entry indicates one extend attribute.
> + *
> + * Note that it can be stored in inode, one block or one xattr bucket.
> + */
> +struct ocfs2_xattr_entry {
> +	__le32	xe_name_hash;    /* hash value of xattr prefix+suffix. */
> +	__le16	xe_name_offset;  /* byte offset from the 1st etnry in the local
> +				    local xattr storage(inode, xattr block or
> +				    xattr bucket). */
> +	__u8	xe_name_len;	 /* xattr name len, does't include prefix. */
> +	__u8	xe_type;         /* the low 7 bits indicates the name prefix's
> +				  * type and the highest 1 bits indicate whether
> +				  * the EA is stored in the local storage. */
> +	__le64	xe_value_size;	 /* real xattr value length. */
> +};
> +
> +/*
> + * On disk structure for xattr header.
> + *
> + * One ocfs2_xattr_header describes how many ocfs2_xattr_entry records in
> + * the local xattr storage.
> + */
> +struct ocfs2_xattr_header {
> +	__le16	xh_count;                       /* contains the count of how
> +						   many records are in the
> +						   local xattr storage. */
> +	__le16	xh_reserved1;
> +	__le32	xh_reserved2;
> +	__le64  xh_csum;
> +	struct ocfs2_xattr_entry xh_entries[0]; /* xattr entry list. */
> +};
> +
> +/*
> + * On disk structure for xattr value root.
> + *
> + * It is used when one extended attribute's size is larger, and we will save it
> + * in an outside cluster. It will stored in a b-tree like file content.
> + */
> +struct ocfs2_xattr_value_root {
> +/*00*/	__le32	xr_clusters;              /* clusters covered by xattr value. */
> +	__le32	xr_reserved0;
> +	__le64	xr_last_eb_blk;           /* Pointer to last extent block */
> +/*10*/	struct ocfs2_extent_list xr_list; /* Extent record list */
> +};
> +
> +/*
> + * On disk structure for xattr tree root.
> + *
> + * It is used when there are too many extended attributes for one file. These
> + * attributes will be organized and stored in an indexed-btree.
> + */
> +struct ocfs2_xattr_tree_root {
> +/*00*/	__le32	xt_clusters;              /* clusters covered by xattr. */
> +	__le32	xt_reserved0;
> +	__le64	xt_last_eb_blk;           /* Pointer to last extent block */
> +/*10*/	struct ocfs2_extent_list xt_list; /* Extent record list */
> +};
> +
> +#define OCFS2_XATTR_INDEXED 0x1
> +
> +/*
> + * On disk structure for xattr block.
> + */
> +struct ocfs2_xattr_block {
> +/*00*/	__u8	xb_signature[8];     /* Signature for verification */
> +	__le16	xb_suballoc_slot;    /* Slot suballocator this
> +					block belongs to. */
> +	__le16	xb_suballoc_bit;     /* Bit offset in suballocator
> +					block group */
> +	__le32	xb_fs_generation;    /* Must match super block */
> +/*10*/	__le64	xb_blkno;            /* Offset on disk, in blocks */
> +	__le64	xb_csum;
> +/*20*/	__le16	xb_flags;            /* Indicates whether this block contains
> +					real xattr or a xattr tree. */
> +	__le16	xb_reserved0;
> +	__le32  xb_reserved1;
> +	__le64	xb_reserved2;
> +/*30*/	union {
> +		struct ocfs2_xattr_header xb_header; /* xattr header if this
> +							block contains xattr */
> +		struct ocfs2_xattr_tree_root xb_root;/* xattr tree root if this
> +							block cotains xattr
> +							tree. */
> +	} xb_attrs;
> +};
> +
> +#define OCFS2_XATTR_ENTRY_LOCAL		0x80
> +#define OCFS2_XATTR_TYPE_MASK		0x7F
> +static inline void ocfs2_xattr_set_local(struct ocfs2_xattr_entry *xe,
> +					 int local)
> +{
> +	if (local)
> +		xe->xe_type |= OCFS2_XATTR_ENTRY_LOCAL;
> +	else
> +		xe->xe_type &= ~OCFS2_XATTR_ENTRY_LOCAL;
> +}
> +
> +static inline int ocfs2_xattr_is_local(struct ocfs2_xattr_entry *xe)
> +{
> +	return xe->xe_type & OCFS2_XATTR_ENTRY_LOCAL;
> +}
> +
> +static inline void ocfs2_xattr_set_type(struct ocfs2_xattr_entry *xe, int type)
> +{
> +	xe->xe_type |= type;

I think it's a good idea to mask out the topmost bit in 'type' here, just in
caes the function gets passed a bogus value, it at least won't affect
whether the xe is considered local or not.

Otherwise, this patch looks great.

Thanks,
	--Mark

--
Mark Fasheh

  reply	other threads:[~2008-08-11  0:03 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-07  6:23 [Ocfs2-devel] [PATCH 0/15] ocfs2: Add extended attributes for ocfs2. V3 Tao Ma
2008-08-06 22:31 ` [Ocfs2-devel] [PATCH 01/15] Modify ocfs2_num_free_extents for future xattr usage Tao Ma
2008-08-06 22:31 ` [Ocfs2-devel] [PATCH 02/15] Use ocfs2_extent_list instead of ocfs2_dinode Tao Ma
2008-08-06 22:31 ` [Ocfs2-devel] [PATCH 03/15] Abstract ocfs2_extent_tree in b-tree operations Tao Ma
2008-08-14 19:55   ` Joel Becker
2008-08-15  7:17     ` Tao Ma
2008-08-06 22:31 ` [Ocfs2-devel] [PATCH 04/15] Make extend allocation generic Tao Ma
2008-08-14 20:01   ` Joel Becker
2008-08-15  7:14     ` Tao Ma
2008-08-14 23:47       ` Joel Becker
2008-08-15  8:44         ` Tao Ma
2008-08-15  6:26           ` Joel Becker
2008-08-15 15:43             ` Tao Ma
2008-08-15 17:59               ` Mark Fasheh
2008-08-15 19:18                 ` Joel Becker
2008-08-16  9:39                 ` Tao Ma
2008-08-15 19:23               ` Joel Becker
2008-08-16  9:49                 ` Tao Ma
2008-08-06 22:31 ` [Ocfs2-devel] [PATCH 05/15] Add xattr header in ocfs2. v3 Tao Ma
2008-08-11  0:03   ` Mark Fasheh [this message]
2008-08-10 16:49     ` [Ocfs2-devel] [PATCH 05/15] Add xattr header in ocfs2.v3 revised Tao Ma
2008-08-11  1:23       ` Mark Fasheh
2008-08-06 22:31 ` [Ocfs2-devel] [PATCH 06/15] Add helper function in uptodate for removing xattr clusters.V3 Tao Ma
2008-08-11  1:22   ` Mark Fasheh
2008-08-06 22:31 ` [Ocfs2-devel] [PATCH 07/15] Add extent tree operation for xattr value.v3 Tao Ma
2008-08-16  2:18   ` Joel Becker
2008-08-16  3:29     ` Joel Becker
2008-08-18 12:52       ` TaoMa
2008-08-16 10:40     ` TaoMa
2008-08-06 22:31 ` [Ocfs2-devel] [PATCH 10/15] Add xattr tree operations in ocfs2_extent_tree.v3 Tao Ma
2008-08-06 22:31 ` [Ocfs2-devel] [PATCH 11/15] Add xattr bucket iteration for large numbers of EAs.v11 Tao Ma
2008-08-12 21:22   ` Mark Fasheh
2008-08-06 22:31 ` [Ocfs2-devel] [PATCH 12/15] Add xattr find process for xattr index btree.v3 Tao Ma
2008-08-12 21:42   ` Mark Fasheh
2008-08-13 17:28     ` Tao Ma
2008-08-13 18:11       ` Mark Fasheh
2008-08-06 22:31 ` [Ocfs2-devel] [PATCH 13/15] Enable xattr set in index btree. v3 Tao Ma
2008-08-12  0:11   ` Mark Fasheh
2008-08-12  1:09     ` Tao Ma
2008-08-12 20:52       ` Mark Fasheh
2008-08-13 17:33         ` [Ocfs2-devel] [PATCH] Refactor ocfs2_insert_extent for not-merging Tao Ma
2008-08-13 20:32           ` Mark Fasheh
2008-08-14  1:13             ` Tao Ma
2008-08-14  2:04               ` Mark Fasheh
2008-08-14 16:22                 ` [Ocfs2-devel] [PATCH] Refactor ocfs2_insert_extent for not-merging. Revised Tao Ma
2008-08-15  3:09                   ` Mark Fasheh
2008-08-12 23:17   ` [Ocfs2-devel] [PATCH 13/15] Enable xattr set in index btree. v3 Mark Fasheh
2008-08-13  0:13     ` Tao Ma
2008-08-13  0:30       ` Mark Fasheh
2008-08-06 22:31 ` [Ocfs2-devel] [PATCH 14/15] Delete all xattr buckets in inode removal.v3 Tao Ma
2008-08-07  7:11 ` [Ocfs2-devel] [PATCH 08/15] ocfs2: reserve inline space for extended attribute Tiger Yang
2008-08-11  1:18   ` Mark Fasheh
2008-08-11  2:15     ` Tiger Yang
2008-08-07  7:11 ` [Ocfs2-devel] [PATCH 09/15] ocfs2: Add extended attribute support v3 Tiger Yang
2008-08-12  0:19   ` Mark Fasheh
2008-08-07  7:12 ` [Ocfs2-devel] [PATCH 15/15] ocfs2: Add incompatible flag for extended attribute v3 Tiger Yang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080811000327.GD28014@wotan.suse.de \
    --to=mfasheh@suse.com \
    --cc=ocfs2-devel@oss.oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.