From: Mark Fasheh <mfasheh@suse.com>
To: ocfs2-devel@oss.oracle.com
Subject: [Ocfs2-devel] [PATCH 08/15] ocfs2: reserve inline space for extended attribute
Date: Sun, 10 Aug 2008 18:18:54 -0700 [thread overview]
Message-ID: <20080811011854.GA21187@wotan.suse.de> (raw)
In-Reply-To: <1218093073-8585-1-git-send-email-tiger.yang@oracle.com>
On Thu, Aug 07, 2008 at 03:11:13PM +0800, Tiger Yang wrote:
> This patch reserve some space in inode block for extended attribute.
> That space used to store extent list or inline data.
This patch looks much better, thanks. One small note below.
> diff --git a/fs/ocfs2/ocfs2.h b/fs/ocfs2/ocfs2.h
> index 3169237..32631a5 100644
> --- a/fs/ocfs2/ocfs2.h
> +++ b/fs/ocfs2/ocfs2.h
> @@ -227,6 +227,7 @@ struct ocfs2_super
> int s_sectsize_bits;
> int s_clustersize;
> int s_clustersize_bits;
> + unsigned int s_xattr_inline_size;
>
> atomic_t vol_state;
> struct mutex recovery_lock;
> diff --git a/fs/ocfs2/ocfs2_fs.h b/fs/ocfs2/ocfs2_fs.h
> index af91f9d..13bf3e5 100644
> --- a/fs/ocfs2/ocfs2_fs.h
> +++ b/fs/ocfs2/ocfs2_fs.h
> @@ -300,6 +300,9 @@ struct ocfs2_new_group_input {
> */
> #define OCFS2_DEFAULT_LOCAL_ALLOC_SIZE 8
>
> +/* Inline extended attribute size (in bytes) */
> +#define OCFS2_MIN_XATTR_INLINE_SIZE 256
> +
> struct ocfs2_system_inode_info {
> char *si_name;
> int si_iflags;
> @@ -622,7 +625,8 @@ struct ocfs2_dinode {
> belongs to */
> __le16 i_suballoc_bit; /* Bit offset in suballocator
> block group */
> -/*10*/ __le32 i_reserved0;
> +/*10*/ __le16 i_reserved0;
> + __le16 i_xattr_inline_size;
> __le32 i_clusters; /* Cluster count */
> __le32 i_uid; /* Owner UID */
> __le32 i_gid; /* Owning GID */
> @@ -641,11 +645,12 @@ struct ocfs2_dinode {
> __le32 i_atime_nsec;
> __le32 i_ctime_nsec;
> __le32 i_mtime_nsec;
> - __le32 i_attr;
> +/*70*/ __le32 i_attr;
> __le16 i_orphaned_slot; /* Only valid when OCFS2_ORPHANED_FL
> was set in i_flags */
> __le16 i_dyn_features;
> -/*70*/ __le64 i_reserved2[8];
> + __le64 i_xattr_loc;
> +/*80*/ __le64 i_reserved2[7];
> /*B8*/ union {
> __le64 i_pad1; /* Generic way to refer to this
> 64bit union */
> @@ -843,6 +848,20 @@ static inline int ocfs2_max_inline_data(struct super_block *sb)
> offsetof(struct ocfs2_dinode, id2.i_data.id_data);
> }
>
> +static inline int ocfs2_max_inline_data_with_xattr(struct super_block *sb,
> + struct ocfs2_dinode *di)
> +{
> + unsigned int xattrsize = le16_to_cpu(di->i_xattr_inline_size);
> +
> + if (le16_to_cpu(di->i_dyn_features) & OCFS2_INLINE_XATTR_FL)
> + return sb->s_blocksize -
> + offsetof(struct ocfs2_dinode, id2.i_data.id_data) -
> + xattrsize;
> + else
> + return sb->s_blocksize -
> + offsetof(struct ocfs2_dinode, id2.i_data.id_data);
> +}
> +
> static inline int ocfs2_extent_recs_per_inode(struct super_block *sb)
> {
> int size;
> @@ -853,6 +872,24 @@ static inline int ocfs2_extent_recs_per_inode(struct super_block *sb)
> return size / sizeof(struct ocfs2_extent_rec);
> }
>
> +static inline int ocfs2_extent_recs_per_inode_with_xattr(
> + struct super_block *sb,
> + struct ocfs2_dinode *di)
> +{
> + int size;
> + unsigned int xattrsize = le16_to_cpu(di->i_xattr_inline_size);
> +
> + if (le16_to_cpu(di->i_dyn_features) & OCFS2_INLINE_XATTR_FL)
> + size = sb->s_blocksize -
> + offsetof(struct ocfs2_dinode, id2.i_list.l_recs) -
> + xattrsize;
> + else
> + size = sb->s_blocksize -
> + offsetof(struct ocfs2_dinode, id2.i_list.l_recs);
> +
> + return size / sizeof(struct ocfs2_extent_rec);
> +}
> +
> static inline int ocfs2_chain_recs_per_inode(struct super_block *sb)
> {
> int size;
> diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c
> index df63ba2..c0a1cdf 100644
> --- a/fs/ocfs2/super.c
> +++ b/fs/ocfs2/super.c
> @@ -1421,6 +1421,8 @@ static int ocfs2_initialize_super(struct super_block *sb,
>
> osb->slot_num = OCFS2_INVALID_SLOT;
>
> + osb->s_xattr_inline_size = OCFS2_MIN_XATTR_INLINE_SIZE;
Why not use the value of i_xattr_inline_size off the super-block inode to
tell the module how large xattrs should be? That way we could allow users to
change it in the future.
By the way, regarding sizes. I just realized that the sizes chosen for
xattrs need to be aligned to 16 byte boundaries (sizeof(struct
ocfs2_extent_rec)) so we don't waste space in the extent list above them.
Does that make sense to you? I think we're safe - you chose the value of
OCFS2_MIN_XATTR_INLINE_SIZE well. A comment above it noting this might be nice though
so that we don't make a mistake in the future.
--Mark
--
Mark Fasheh
next prev parent reply other threads:[~2008-08-11 1:18 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
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 [this message]
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=20080811011854.GA21187@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.