From: Tao Ma <tao.ma@oracle.com>
To: ocfs2-devel@oss.oracle.com
Subject: [Ocfs2-devel] [PATCH 06/13] ocfs2: Improve ocfs2_read_xattr_bucket().
Date: Tue, 28 Oct 2008 10:44:35 +0800 [thread overview]
Message-ID: <49067C93.3050307@oracle.com> (raw)
In-Reply-To: <1225156828-32189-7-git-send-email-joel.becker@oracle.com>
Joel Becker wrote:
> The ocfs2_read_xattr_bucket() function would read an xattr bucket into a
> list of buffer heads. However, we have a nice ocfs2_xattr_bucket
> structure. Let's have it fill that out instead.
>
> In addition, ocfs2_read_xattr_bucket() would initialize buffer heads for
> a bucket that's never been on disk before. That's confusing. Let's
> call that functionality ocfs2_init_xattr_bucket().
>
> The functions ocfs2_cp_xattr_bucket() and ocfs2_half_xattr_bucket() are
> updated to use the ocfs2_xattr_bucket structure rather than raw bh
> lists. That way they can use the new read/init calls. In addition,
> they drop the wasted read of an existing target bucket.
>
> Signed-off-by: Joel Becker <joel.becker@oracle.com>
> ---
> /*
> * Move half num of the xattrs in old bucket(blk) to new bucket(new_blk).
> * first_hash will record the 1st hash of the new bucket.
> @@ -3128,7 +3145,7 @@ static int ocfs2_half_xattr_bucket(struct inode *inode,
> int ret, i;
> u16 count, start, len, name_value_len, xe_len, name_offset;
> u16 blk_per_bucket = ocfs2_blocks_per_xattr_bucket(inode->i_sb);
> - struct buffer_head **s_bhs, **t_bhs = NULL;
> + struct ocfs2_xattr_bucket s_bucket, t_bucket;
> struct ocfs2_xattr_header *xh;
> struct ocfs2_xattr_entry *xe;
> int blocksize = inode->i_sb->s_blocksize;
snip
> - t_bhs = kcalloc(blk_per_bucket, sizeof(struct buffer_head *), GFP_NOFS);
> - if (!t_bhs) {
> - ret = -ENOMEM;
> - goto out;
> - }
> -
> - ret = ocfs2_read_xattr_bucket(inode, new_blk, t_bhs, new_bucket_head);
> + /*
> + * Even if !new_bucket_head, we're overwriting t_bucket. Thus,
> + * there's no need to read it.
> + */
> + ret = ocfs2_init_xattr_bucket(inode, &t_bucket, new_blk);
> if (ret) {
> mlog_errno(ret);
> goto out;
> }
>
> for (i = 0; i < blk_per_bucket; i++) {
> - ret = ocfs2_journal_access(handle, inode, t_bhs[i],
> + ret = ocfs2_journal_access(handle, inode, t_bucket.bu_bhs[i],
> new_bucket_head ?
> OCFS2_JOURNAL_ACCESS_CREATE :
> OCFS2_JOURNAL_ACCESS_WRITE);
I have read the caller of ocfs2_half_xattr_bucket again. In
ocfs2_extend_xattr_bucket when we want to half the bucket to a
never-used new bucket within the same cluster(while we always pass
new_bucket_head=0), do we need to use OCFS2_JOURNAL_ACCESS_CREATE? If
yes, maybe we have to modify the caller to be more precisely(I can
handle this based on your patch set). The same goes for
ocfs2_cp_xattr_bucket.
Regards,
Tao
next prev parent reply other threads:[~2008-10-28 2:44 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-28 1:20 [Ocfs2-devel] [PATCH 0/13] ocfs2: xattr bucket API Joel Becker
2008-10-28 1:20 ` [Ocfs2-devel] [PATCH 01/13] ocfs2: Field prefixes for the xattr_bucket structure Joel Becker
2008-10-28 1:20 ` [Ocfs2-devel] [PATCH 02/13] ocfs2: Convenient access to an xattr bucket's block number Joel Becker
2008-10-28 1:20 ` [Ocfs2-devel] [PATCH 03/13] ocfs2: Convenient access to xattr bucket data blocks Joel Becker
2008-10-28 1:20 ` [Ocfs2-devel] [PATCH 04/13] ocfs2: Convenient access to an xattr bucket's header Joel Becker
2008-10-28 1:20 ` [Ocfs2-devel] [PATCH 05/13] ocfs2: Provide a wrapper to brelse() xattr bucket buffers Joel Becker
2008-10-28 1:20 ` [Ocfs2-devel] [PATCH 06/13] ocfs2: Improve ocfs2_read_xattr_bucket() Joel Becker
2008-10-28 2:44 ` Tao Ma [this message]
2008-10-28 6:14 ` Joel Becker
2008-10-28 6:25 ` Tao Ma
2008-10-28 1:20 ` [Ocfs2-devel] [PATCH 07/13] ocfs2: Wrap journal_access/journal_dirty for xattr buckets Joel Becker
2008-10-28 1:20 ` [Ocfs2-devel] [PATCH 08/13] ocfs2: Copy xattr buckets with a dedicated function Joel Becker
2008-10-28 1:20 ` [Ocfs2-devel] [PATCH 09/13] ocfs2: Take ocfs2_xattr_bucket structures off of the stack Joel Becker
2008-10-28 1:50 ` Tao Ma
2008-10-28 1:53 ` Joel Becker
2008-10-28 2:24 ` Tao Ma
2008-10-28 6:16 ` Joel Becker
2008-10-28 1:20 ` [Ocfs2-devel] [PATCH 10/13] ocfs2: Use buckets in ocfs2_xattr_bucket_find() Joel Becker
2008-10-28 1:20 ` [Ocfs2-devel] [PATCH 11/13] ocfs2: Use buckets in ocfs2_xattr_create_index_block() Joel Becker
2008-10-28 1:20 ` [Ocfs2-devel] [PATCH 12/13] ocfs2: Use buckets in ocfs2_defrag_xattr_bucket() Joel Becker
2008-10-28 1:20 ` [Ocfs2-devel] [PATCH 13/13] ocfs2: Use buckets in ocfs2_xattr_set_entry_in_bucket() Joel Becker
2008-11-07 21:21 ` [Ocfs2-devel] [PATCH 0/13] ocfs2: xattr bucket API Mark Fasheh
2008-11-07 21:36 ` Joel Becker
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=49067C93.3050307@oracle.com \
--to=tao.ma@oracle.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.