From: Tao Ma <tao.ma@oracle.com>
To: ocfs2-devel@oss.oracle.com
Subject: [Ocfs2-devel] [PATCH 12/15] Add xattr find process for xattr index btree.v2
Date: Sat, 12 Jul 2008 08:42:18 +0800 [thread overview]
Message-ID: <4877FDEA.4090801@oracle.com> (raw)
In-Reply-To: <20080711235914.GD9557@wotan.suse.de>
Mark Fasheh wrote:
> On Fri, Jun 27, 2008 at 03:02:35PM +0800, Tao Ma wrote:
>> +/*
>> + * Find the specided xattr entry in a series of buckets.
>> + * This series start from p_blkno and last for num_clusters.
>> + * The ocfs2_xattr_header.xh_reserved1 of the first bucket contains
>> + * the num of the valid buckets.
>> + *
>> + * Return the buffer_head this xattr should reside in. And if the xattr's
>> + * hash is in the gap of 2 buckets, return the lower bucket.
>> + */
>> +static int ocfs2_xattr_bucket_find(struct inode *inode,
>> + int name_index,
>> + const char *name,
>> + u32 name_hash,
>> + u64 p_blkno,
>> + u32 first_hash,
>> + u32 num_clusters,
>> + struct ocfs2_xattr_search *xs)
>> +{
>> + int ret, found = 0;
>> + struct buffer_head *bh = NULL;
>> + struct buffer_head *last_bh = NULL;
>> + struct buffer_head *lower_bh = NULL;
>> + struct ocfs2_xattr_header *xh = NULL;
>> + struct ocfs2_xattr_entry *xe = NULL;
>> + u16 xh_count, xe_index = 0;
>> + u16 block_in_bucket = ocfs2_blocks_per_xattr_bucket(inode->i_sb);
>> + int low_bucket = 0, bucket, high_bucket;
>> + int blocksize = inode->i_sb->s_blocksize;
>> + u32 last_hash;
>> + u64 blkno;
>> +
>> + ret = ocfs2_read_block(OCFS2_SB(inode->i_sb), p_blkno,
>> + &bh, OCFS2_BH_CACHED, inode);
>> + if (ret)
>> + goto out;
>> + xh = (struct ocfs2_xattr_header *)bh->b_data;
>> + high_bucket = le16_to_cpu(xh->xh_reserved1) - 1;
>> +
>> + while (low_bucket <= high_bucket) {
>> + brelse(bh);
>> + bh = last_bh = NULL;
>> + bucket = (low_bucket + high_bucket) / 2;
>> +
>> + blkno = p_blkno + bucket * block_in_bucket;
>> +
>> + ret = ocfs2_read_block(OCFS2_SB(inode->i_sb), blkno,
>> + &bh, OCFS2_BH_CACHED, inode);
>> + if (ret) {
>> + mlog_errno(ret);
>> + goto out;
>> + }
>> +
>> + xh = (struct ocfs2_xattr_header *)bh->b_data;
>> + xe = &xh->xh_entries[0];
>> + if (name_hash < le32_to_cpu(xe->xe_name_hash)) {
>> + high_bucket = bucket - 1;
>> + continue;
>> + }
>
> This function looks like it's doing a lot of random I/O. What about sucking
> up some large numbers of (contiguous) blocks with a readahead request before
> going into this function? The beauty of how our readhead works is that you
> wouldn't have to change a single line of code here..
Do you mean add OCFS2_BH_READAHEAD in read_block flag?
Not sure whether readahead can help us much. We normally only read the
header of a bucket, as for bs=1K, we only read 1 block for every 4
blocks, so most of readahead is useless. And even worse, with binary
search, we really don't know which block we will read before the search.
So can readahead help us in this issue? I am not familiar with IO
readahead, so please be patient and explain it to you if you have time. ;)
Regards,
Tao
next prev parent reply other threads:[~2008-07-12 0:42 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-27 6:39 [Ocfs2-devel] [PATCH 0/15] ocfs2: Add extended attributes for ocfs2. V2 Tao Ma
2008-06-27 6:59 ` [Ocfs2-devel] [PATCH 01/15] Modify ocfs2_num_free_extents for future xattr usage. v2 Tao Ma
2008-06-27 7:00 ` [Ocfs2-devel] [PATCH 02/15] Use ocfs2_extent_list instead of ocfs2_dinode. v2 Tao Ma
2008-06-27 7:00 ` [Ocfs2-devel] [PATCH 03/15] Abstract ocfs2_extent_tree in b-tree operations. v2 Tao Ma
2008-06-27 7:00 ` [Ocfs2-devel] [PATCH 04/15] Make extend allocation generic.v2 Tao Ma
2008-06-27 7:01 ` [Ocfs2-devel] [PATCH 05/15] Add xattr header in ocfs2.v2 Tao Ma
2008-07-09 22:59 ` Mark Fasheh
2008-07-10 4:50 ` Tao Ma
2008-07-17 0:30 ` Mark Fasheh
2008-07-19 0:44 ` Joel Becker
2008-06-27 7:01 ` [Ocfs2-devel] [PATCH 06/15] Add extent tree operation for xattr value.v2 Tao Ma
2008-07-09 23:10 ` Mark Fasheh
2008-07-10 4:30 ` Tao Ma
2008-06-27 7:01 ` [Ocfs2-devel] [PATCH 09/15] Add helper function in uptodate for removing xattr clusters.v2 Tao Ma
2008-07-10 23:15 ` Mark Fasheh
2008-07-10 23:19 ` Mark Fasheh
2008-06-27 7:02 ` [Ocfs2-devel] [PATCH 10/15] Add xattr tree operations in ocfs2_extent_tree.v2 Tao Ma
2008-06-27 7:02 ` [Ocfs2-devel] [PATCH 11/15] Add xattr bucket iteration for large numbers of EAs.v2 Tao Ma
2008-07-11 20:32 ` Mark Fasheh
2008-07-11 23:52 ` Tao Ma
2008-07-11 23:58 ` Mark Fasheh
2008-06-27 7:02 ` [Ocfs2-devel] [PATCH 12/15] Add xattr find process for xattr index btree.v2 Tao Ma
2008-07-11 23:59 ` Mark Fasheh
2008-07-12 0:42 ` Tao Ma [this message]
2008-07-18 0:47 ` Mark Fasheh
2008-06-27 7:02 ` [Ocfs2-devel] [PATCH 13/15] Enable xattr set in " Tao Ma
2008-07-18 0:30 ` Mark Fasheh
2008-06-27 7:03 ` [Ocfs2-devel] [PATCH 14/15] Delete all xattr buckets in inode removal.v2 Tao Ma
2008-06-27 7:27 ` [Ocfs2-devel] [PATCH 07/15] ocfs2: reserve inline space for extended attribute v2 Tiger Yang
2008-06-27 7:27 ` [Ocfs2-devel] [PATCH 08/15] ocfs2: Add extended attribute support v2 Tiger Yang
2008-06-27 7:27 ` [Ocfs2-devel] [PATCH 15/15] ocfs2: Add incompatible flag for extended attribute v2 Tiger Yang
2008-07-10 23:00 ` Mark Fasheh
2008-07-10 23:22 ` Joel Becker
2008-07-10 23:34 ` Mark Fasheh
2008-07-16 3:06 ` Tiger Yang
2008-07-16 17:39 ` Joel Becker
2008-07-10 23:11 ` [Ocfs2-devel] [PATCH 08/15] ocfs2: Add extended attribute support v2 Mark Fasheh
2008-07-11 2:21 ` tristan
2008-07-11 9:39 ` Tiger Yang
2008-07-17 9:34 ` Tiger Yang
2008-07-17 18:13 ` Mark Fasheh
2008-07-25 9:10 ` Tiger Yang
2008-07-11 19:47 ` Mark Fasheh
2008-07-17 9:39 ` Tiger Yang
2008-07-17 18:11 ` Mark Fasheh
2008-07-15 21:28 ` Mark Fasheh
2008-07-10 1:24 ` [Ocfs2-devel] [PATCH 07/15] ocfs2: reserve inline space for extended attribute v2 Mark Fasheh
2008-07-11 8:55 ` 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=4877FDEA.4090801@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.