Two minor fixes for Joel's xattr-buckets branch.
PATCH 1/2 ocfs2/xattr: Remove additional bucket allocation in bucket defragment.
In reply to Tao MaJoel has refactored xattr bucket and make xattr bucket a general wrapper. So in ocfs2_defrag_xattr_bucket, we have already passed the bucket in, so there is no need to allocate a new one and read it.
--- fs/ocfs2/xattr.c | 26 +++++++------------------- 1 files changed, 7 insertions(+), 19 deletions(-)
fs/ocfs2/xattr.c +7 -19
@@ -2896,7 +2896,6 @@ static int ocfs2_defrag_xattr_bucket(struct inode *inode,size_t blocksize = inode->i_sb->s_blocksize;handle_t *handle;struct ocfs2_xattr_entry *xe; -struct ocfs2_xattr_bucket *wb =NULL ;/* * In order to make the operation more efficient and generic,
@@ -2910,21 +2909,11 @@ static int ocfs2_defrag_xattr_bucket(struct inode *inode, goto out; } - wb =ocfs2_xattr_bucket_new (inode); -if (!wb) { - ret = -ENOMEM ; - goto out; - } - - ret =ocfs2_read_xattr_bucket (wb, blkno); -if (ret) - goto out; - buf = bucket_buf; -for (i =0 ; i < wb->bu_blocks; i++, buf += blocksize) -memcpy (buf,bucket_block (wb, i), blocksize); +for (i =0 ; i < bucket->bu_blocks; i++, buf += blocksize) +memcpy (buf,bucket_block (bucket, i), blocksize); - handle =ocfs2_start_trans ((OCFS2_SB (inode->i_sb)), wb->bu_blocks); + handle =ocfs2_start_trans ((OCFS2_SB (inode->i_sb)), bucket->bu_blocks);if (IS_ERR (handle)) { ret =PTR_ERR (handle); handle =NULL ;
@@ -2932,7 +2921,7 @@ static int ocfs2_defrag_xattr_bucket(struct inode *inode, goto out; } - ret =ocfs2_xattr_bucket_journal_access (handle, wb, + ret =ocfs2_xattr_bucket_journal_access (handle, bucket,OCFS2_JOURNAL_ACCESS_WRITE );if (ret <0 ) {mlog_errno (ret);
@@ -3005,14 +2994,13 @@ static int ocfs2_defrag_xattr_bucket(struct inode *inode, cmp_xe, swap_xe); buf = bucket_buf; -for (i =0 ; i < wb->bu_blocks; i++, buf += blocksize) -memcpy (bucket_block (wb, i), buf, blocksize); -ocfs2_xattr_bucket_journal_dirty (handle, wb); +for (i =0 ; i < bucket->bu_blocks; i++, buf += blocksize) +memcpy (bucket_block (bucket, i), buf, blocksize); +ocfs2_xattr_bucket_journal_dirty (handle, bucket); commit:ocfs2_commit_trans (OCFS2_SB (inode->i_sb), handle); out: -ocfs2_xattr_bucket_free (wb);kfree (bucket_buf);return ret; }
Signature · 1 line
1.5.4.GIT
PATCH 2/2 ocfs2/xattr: Only set buffer update if it doesn't exist in cache.
In reply to Tao MaWhen we call ocfs2_init_xattr_bucket, we deem that the new buffer head will be written to disk immediately, so we just use sb_getblk. But in some cases the buffer may have already been in ocfs2 uptodate cache, so we only call ocfs2_set_buffer_uptodate if the buffer head isn't in the cache.
--- fs/ocfs2/xattr.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-)
fs/ocfs2/xattr.c +4 -2
@@ -219,8 +219,10 @@ static int ocfs2_init_xattr_bucket(struct ocfs2_xattr_bucket *bucket,break ; } -ocfs2_set_new_buffer_uptodate (bucket->bu_inode, - bucket->bu_bhs[i]); +if (!ocfs2_buffer_uptodate (bucket->bu_inode, + bucket->bu_bhs[i])) +ocfs2_set_new_buffer_uptodate (bucket->bu_inode, + bucket->bu_bhs[i]); }if (rc)
Signature · 1 line
1.5.4.GIT
cover Two minor fixes for Joel's xattr-buckets branch.
Hi Joel,
These 2 patches are minor fixes and improvement for your xattr -buckets
branch. Could you please review them? And if they are OK, please push them to your branch so that I can rebase my transaction merge patch set on it. One is for ocfs2_defrag_xattr_bucket improvement and another is for the ocfs2_buffer_uptodate check in ocfs2_init_xattr_bucket. I saw your branch haven't been updated for some days, so create these 2 patches for you. ;)
Mark,
these 2 patches can be pushed into Joel's branch so that you can
finally pull them together with acls after we rebase on it.
Regards,
Tao
cover Two minor fixes for Joel's xattr-buckets branch.
Quoted 8 lines · Tao Ma
Hi Joel,
These 2 patches are minor fixes and improvement for your xattr -buckets
branch. Could you please review them? And if they are OK, please push them to your branch so that I can rebase my transaction merge patch set on it. One is forocfs2_defrag_xattr_bucketimprovement and another is for theocfs2_buffer_uptodatecheck inocfs2_init_xattr_bucket. I saw your branch haven't been updated for some days, so create these 2 patches for you. ;)
Thanks Tao, these are pushed to my xattr-buckets branch now.
Joel
Signature · 9 lines
"In a crisis, don't hide behind anything or anybody. They're going to find you anyway." - Paul "Bear" Bryant Joel Becker Principal Software Developer Oracle E-mail: joel.becker at oracle.com Phone: (650) 506-8127