ocfs2: set gap to seperate entry and value when xattr in bucket
PATCH 1/1 ocfs2: set gap to seperate entry and value when xattr in bucket
This patch set a gap (4 bytes) between xattr entry and name/value when xattr in bucket. This gap use to seperate entry and name/value when a bucket is full. It had already been set when xattr in inode/block.
--- fs/ocfs2/xattr.c | 18 ++++++++++-------- 1 files changed, 10 insertions(+), 8 deletions(-)
fs/ocfs2/xattr.c +10 -8
@@ -82,13 +82,14 @@ struct ocfs2_xattr_set_ctxt {#define OCFS2_XATTR_ROOT_SIZE (sizeof(struct ocfs2_xattr_def_value_root))#define OCFS2_XATTR_INLINE_SIZE 80 +#define OCFS2_XATTR_HEADER_GAP 4#define OCFS2_XATTR_FREE_IN_IBODY (OCFS2_MIN_XATTR_INLINE_SIZE \ - sizeof(struct ocfs2_xattr_header) \ - - sizeof(__u32)) + - OCFS2_XATTR_HEADER_GAP)#define OCFS2_XATTR_FREE_IN_BLOCK (ptr) ((ptr)->i_sb->s_blocksize \ - sizeof(struct ocfs2_xattr_block) \ - sizeof(struct ocfs2_xattr_header) \ - - sizeof(__u32)) + - OCFS2_XATTR_HEADER_GAP)static struct ocfs2_xattr_def_value_root def_xv = { .xv.xr_list.l_count =cpu_to_le16 (1 ),
@@ -1507,7 +1508,7 @@ static int ocfs2_xattr_set_entry(struct inode *inode, last +=1 ; } - free = min_offs - ((void *)last - xs->base) -sizeof (__u32); + free = min_offs - ((void *)last - xs->base) -OCFS2_XATTR_HEADER_GAP ;if (free <0 )return -EIO ;
@@ -2190,7 +2191,7 @@ static int ocfs2_xattr_can_be_in_inode(struct inode *inode, last +=1 ; } - free = min_offs - ((void *)last - xs->base) -sizeof (__u32); + free = min_offs - ((void *)last - xs->base) -OCFS2_XATTR_HEADER_GAP ;if (free <0 )return 0 ;
@@ -5060,8 +5061,8 @@ try_again: xh_free_start =le16_to_cpu (xh->xh_free_start); header_size =sizeof (struct ocfs2_xattr_header ) + count *sizeof (struct ocfs2_xattr_entry ); - max_free =OCFS2_XATTR_BUCKET_SIZE - -le16_to_cpu (xh->xh_name_value_len) - header_size; + max_free =OCFS2_XATTR_BUCKET_SIZE - header_size - +le16_to_cpu (xh->xh_name_value_len) -OCFS2_XATTR_HEADER_GAP ; mlog_bug_on_msg(header_size > blocksize, "bucket %llu has header size " "of %u which exceed block size\n",
@@ -5094,7 +5095,7 @@ try_again: need =0 ; } - free = xh_free_start - header_size; + free = xh_free_start - header_size -OCFS2_XATTR_HEADER_GAP ;/* * We need to make sure the new name/value pair * can exist in the same block.
@@ -5127,7 +5128,8 @@ try_again: } xh_free_start =le16_to_cpu (xh->xh_free_start); - free = xh_free_start - header_size; + free = xh_free_start - header_size + -OCFS2_XATTR_HEADER_GAP ;if (xh_free_start % blocksize < need) free -= xh_free_start % blocksize;
Signature · 1 line
1.5.4.1
PATCH 1/1 ocfs2: set gap to seperate entry and value when xattr in bucket
Quoted 6 lines · Tiger Yang
This patch set a gap (4 bytes) between xattr entry and name/value when xattr in bucket. This gap use to seperate entry and name/value when a bucket is full. It had already been set when xattr in inode/block.
Signed-off-by Tiger Yang <[email protected]>
Has this passed tristan's tests?
Joel
Quoted 76 lines
--- fs/ocfs2/xattr.c | 18 ++++++++++-------- 1 files changed, 10 insertions(+), 8 deletions(-)fs/ocfs2/xattr.c +10
-8@@ -82,13 +82,14 @@ struct ocfs2_xattr_set_ctxt {#define OCFS2_XATTR_ROOT_SIZE (sizeof(struct ocfs2_xattr_def_value_root))#define OCFS2_XATTR_INLINE_SIZE 80 +#define OCFS2_XATTR_HEADER_GAP 4#define OCFS2_XATTR_FREE_IN_IBODY (OCFS2_MIN_XATTR_INLINE_SIZE \ - sizeof(struct ocfs2_xattr_header) \ - - sizeof(__u32)) + - OCFS2_XATTR_HEADER_GAP)#define OCFS2_XATTR_FREE_IN_BLOCK (ptr) ((ptr)->i_sb->s_blocksize \ - sizeof(struct ocfs2_xattr_block) \ - sizeof(struct ocfs2_xattr_header) \ - - sizeof(__u32)) + - OCFS2_XATTR_HEADER_GAP)static struct ocfs2_xattr_def_value_root def_xv = { .xv.xr_list.l_count =cpu_to_le16 (1 ),@@ -1507,7 +1508,7 @@ static int ocfs2_xattr_set_entry(struct inode *inode, last +=1 ; } - free = min_offs - ((void *)last - xs->base) -sizeof (__u32); + free = min_offs - ((void *)last - xs->base) -OCFS2_XATTR_HEADER_GAP ;if (free <0 )return -EIO ;@@ -2190,7 +2191,7 @@ static int ocfs2_xattr_can_be_in_inode(struct inode *inode, last +=1 ; } - free = min_offs - ((void *)last - xs->base) -sizeof (__u32); + free = min_offs - ((void *)last - xs->base) -OCFS2_XATTR_HEADER_GAP ;if (free <0 )return 0 ;@@ -5060,8 +5061,8 @@ try_again: xh_free_start =le16_to_cpu (xh->xh_free_start); header_size =sizeof (struct ocfs2_xattr_header ) + count *sizeof (struct ocfs2_xattr_entry ); - max_free =OCFS2_XATTR_BUCKET_SIZE - -le16_to_cpu (xh->xh_name_value_len) - header_size; + max_free =OCFS2_XATTR_BUCKET_SIZE - header_size - +le16_to_cpu (xh->xh_name_value_len) -OCFS2_XATTR_HEADER_GAP ; mlog_bug_on_msg(header_size > blocksize, "bucket %llu has header size " "of %u which exceed block size\n",@@ -5094,7 +5095,7 @@ try_again: need =0 ; } - free = xh_free_start - header_size; + free = xh_free_start - header_size -OCFS2_XATTR_HEADER_GAP ;/* * We need to make sure the new name/value pair * can exist in the same block. @@ -5127,7 +5128,8 @@ try_again: } xh_free_start =le16_to_cpu (xh->xh_free_start); - free = xh_free_start - header_size; + free = xh_free_start - header_size + -OCFS2_XATTR_HEADER_GAP ;if (xh_free_start % blocksize < need) free -= xh_free_start % blocksize;Signature · 1 line
1.5.4.1
Signature · 9 lines
"The doctrine of human equality reposes on this: that there is no man really clever who has not found that he is stupid." - Gilbert K. Chesterson Joel Becker Principal Software Developer Oracle E-mail: joel.becker at oracle.com Phone: (650) 506-8127
PATCH 1/1 ocfs2: set gap to seperate entry and value when xattr in bucket
Quoted 11 lines · Joel Becker
Quoted 6 lines · Tiger Yang
This patch set a gap (4 bytes) between xattr entry and name/value when xattr in bucket. This gap use to seperate entry and name/value when a bucket is full. It had already been set when xattr in inode/block.
Signed-off-by Tiger Yang <[email protected]>Acked-by Joel Becker <[email protected]>Has this passed tristan's tests?
Tiger,
Let me know the kernel branch your patch based on, then I can schedule the tests for you if you wish:-)
Tristan
Quoted 80 lines
Joel
Quoted 76 lines
--- fs/ocfs2/xattr.c | 18 ++++++++++-------- 1 files changed, 10 insertions(+), 8 deletions(-)fs/ocfs2/xattr.c +10
-8@@ -82,13 +82,14 @@ struct ocfs2_xattr_set_ctxt {#define OCFS2_XATTR_ROOT_SIZE (sizeof(struct ocfs2_xattr_def_value_root))#define OCFS2_XATTR_INLINE_SIZE 80 +#define OCFS2_XATTR_HEADER_GAP 4#define OCFS2_XATTR_FREE_IN_IBODY (OCFS2_MIN_XATTR_INLINE_SIZE \ - sizeof(struct ocfs2_xattr_header) \ - - sizeof(__u32)) + - OCFS2_XATTR_HEADER_GAP)#define OCFS2_XATTR_FREE_IN_BLOCK (ptr) ((ptr)->i_sb->s_blocksize \ - sizeof(struct ocfs2_xattr_block) \ - sizeof(struct ocfs2_xattr_header) \ - - sizeof(__u32)) + - OCFS2_XATTR_HEADER_GAP)static struct ocfs2_xattr_def_value_root def_xv = { .xv.xr_list.l_count =cpu_to_le16 (1 ),@@ -1507,7 +1508,7 @@ static int ocfs2_xattr_set_entry(struct inode *inode, last +=1 ; } - free = min_offs - ((void *)last - xs->base) -sizeof (__u32); + free = min_offs - ((void *)last - xs->base) -OCFS2_XATTR_HEADER_GAP ;if (free <0 )return -EIO ;@@ -2190,7 +2191,7 @@ static int ocfs2_xattr_can_be_in_inode(struct inode *inode, last +=1 ; } - free = min_offs - ((void *)last - xs->base) -sizeof (__u32); + free = min_offs - ((void *)last - xs->base) -OCFS2_XATTR_HEADER_GAP ;if (free <0 )return 0 ;@@ -5060,8 +5061,8 @@ try_again: xh_free_start =le16_to_cpu (xh->xh_free_start); header_size =sizeof (struct ocfs2_xattr_header ) + count *sizeof (struct ocfs2_xattr_entry ); - max_free =OCFS2_XATTR_BUCKET_SIZE - -le16_to_cpu (xh->xh_name_value_len) - header_size; + max_free =OCFS2_XATTR_BUCKET_SIZE - header_size - +le16_to_cpu (xh->xh_name_value_len) -OCFS2_XATTR_HEADER_GAP ; mlog_bug_on_msg(header_size > blocksize, "bucket %llu has header size " "of %u which exceed block size\n",@@ -5094,7 +5095,7 @@ try_again: need =0 ; } - free = xh_free_start - header_size; + free = xh_free_start - header_size -OCFS2_XATTR_HEADER_GAP ;/* * We need to make sure the new name/value pair * can exist in the same block. @@ -5127,7 +5128,8 @@ try_again: } xh_free_start =le16_to_cpu (xh->xh_free_start); - free = xh_free_start - header_size; + free = xh_free_start - header_size + -OCFS2_XATTR_HEADER_GAP ;if (xh_free_start % blocksize < need) free -= xh_free_start % blocksize;Signature · 1 line
1.5.4.1
PATCH 1/1 ocfs2: set gap to seperate entry and value when xattr in bucket
In reply to Joel BeckerQuoted 11 lines · Joel Becker
Quoted 6 lines · Tiger Yang
This patch set a gap (4 bytes) between xattr entry and name/value when xattr in bucket. This gap use to seperate entry and name/value when a bucket is full. It had already been set when xattr in inode/block.
Signed-off-by Tiger Yang <[email protected]>Acked-by Joel Becker <[email protected]>Has this passed tristan's tests?
Tiger,
Don't worry about the patch, I've tested it out with tao's spinlock patch,
the result was fairly cool, all tests passed.
Refer to following URL for a detail testing info:
Regards,
Tristan
Quoted 80 lines
Joel
Quoted 76 lines
--- fs/ocfs2/xattr.c | 18 ++++++++++-------- 1 files changed, 10 insertions(+), 8 deletions(-)fs/ocfs2/xattr.c +10
-8@@ -82,13 +82,14 @@ struct ocfs2_xattr_set_ctxt {#define OCFS2_XATTR_ROOT_SIZE (sizeof(struct ocfs2_xattr_def_value_root))#define OCFS2_XATTR_INLINE_SIZE 80 +#define OCFS2_XATTR_HEADER_GAP 4#define OCFS2_XATTR_FREE_IN_IBODY (OCFS2_MIN_XATTR_INLINE_SIZE \ - sizeof(struct ocfs2_xattr_header) \ - - sizeof(__u32)) + - OCFS2_XATTR_HEADER_GAP)#define OCFS2_XATTR_FREE_IN_BLOCK (ptr) ((ptr)->i_sb->s_blocksize \ - sizeof(struct ocfs2_xattr_block) \ - sizeof(struct ocfs2_xattr_header) \ - - sizeof(__u32)) + - OCFS2_XATTR_HEADER_GAP)static struct ocfs2_xattr_def_value_root def_xv = { .xv.xr_list.l_count =cpu_to_le16 (1 ),@@ -1507,7 +1508,7 @@ static int ocfs2_xattr_set_entry(struct inode *inode, last +=1 ; } - free = min_offs - ((void *)last - xs->base) -sizeof (__u32); + free = min_offs - ((void *)last - xs->base) -OCFS2_XATTR_HEADER_GAP ;if (free <0 )return -EIO ;@@ -2190,7 +2191,7 @@ static int ocfs2_xattr_can_be_in_inode(struct inode *inode, last +=1 ; } - free = min_offs - ((void *)last - xs->base) -sizeof (__u32); + free = min_offs - ((void *)last - xs->base) -OCFS2_XATTR_HEADER_GAP ;if (free <0 )return 0 ;@@ -5060,8 +5061,8 @@ try_again: xh_free_start =le16_to_cpu (xh->xh_free_start); header_size =sizeof (struct ocfs2_xattr_header ) + count *sizeof (struct ocfs2_xattr_entry ); - max_free =OCFS2_XATTR_BUCKET_SIZE - -le16_to_cpu (xh->xh_name_value_len) - header_size; + max_free =OCFS2_XATTR_BUCKET_SIZE - header_size - +le16_to_cpu (xh->xh_name_value_len) -OCFS2_XATTR_HEADER_GAP ; mlog_bug_on_msg(header_size > blocksize, "bucket %llu has header size " "of %u which exceed block size\n",@@ -5094,7 +5095,7 @@ try_again: need =0 ; } - free = xh_free_start - header_size; + free = xh_free_start - header_size -OCFS2_XATTR_HEADER_GAP ;/* * We need to make sure the new name/value pair * can exist in the same block. @@ -5127,7 +5128,8 @@ try_again: } xh_free_start =le16_to_cpu (xh->xh_free_start); - free = xh_free_start - header_size; + free = xh_free_start - header_size + -OCFS2_XATTR_HEADER_GAP ;if (xh_free_start % blocksize < need) free -= xh_free_start % blocksize;Signature · 1 line
1.5.4.1