All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tao Ma <tao.ma@oracle.com>
To: ocfs2-devel@oss.oracle.com
Subject: [Ocfs2-devel] [PATCH 01/14] ocfs2: Introduce ocfs2_xa_loc
Date: Tue, 01 Sep 2009 16:49:52 +0800	[thread overview]
Message-ID: <4A9CE030.4070605@oracle.com> (raw)
In-Reply-To: <20090901084558.GE3826@mail.oracle.com>



Joel Becker wrote:
> On Tue, Sep 01, 2009 at 01:26:54AM -0700, Joel Becker wrote:
>> On Tue, Sep 01, 2009 at 01:32:37PM +0800, Tao Ma wrote:
>>> Joel Becker wrote:
>>>> +static void *ocfs2_xa_block_offset_pointer(struct ocfs2_xa_loc *loc,
>>>> +					   int offset)
>>>> +{
>>>> +	struct buffer_head *bh = loc->xl_storage;
>>>> +
>>>> +	BUG_ON(offset >= bh->b_size);
>>>> +	return bh->b_data + offset;
>>>> +}
>>> It looks that the "offset" is from the start of the buffer, while in
>>> your description above "offset" is from "loc->xl_header". In both
>>> inline and block case, header != buffer_start. xl_size seems to be
>>> against xl_header, so I would guess here you need to change somehow.
>> 	Doh!  That's a bug.  The description matches reality -
>> xe_name_offset is from the start of the header, not the block, right?
>> So this function is just wrong!
> 
> 	What about this delta?
looks good to me.

Regards,
Tao
> 
> Joel
> 
> 
> diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c
> index d485932..abc8043 100644
> --- a/fs/ocfs2/xattr.c
> +++ b/fs/ocfs2/xattr.c
> @@ -1442,6 +1442,7 @@ static void ocfs2_xa_journal_dirty(handle_t *handle, struct ocfs2_xa_loc *loc)
>  /* Give a pointer into the storage for the given offset */
>  static void *ocfs2_xa_offset_pointer(struct ocfs2_xa_loc *loc, int offset)
>  {
> +	BUG_ON(offset >= loc->xl_size);
>  	return loc->xl_ops->xlo_offset_pointer(loc, offset);
>  }
>  
> @@ -1552,10 +1553,7 @@ static void ocfs2_xa_block_journal_dirty(handle_t *handle,
>  static void *ocfs2_xa_block_offset_pointer(struct ocfs2_xa_loc *loc,
>  					   int offset)
>  {
> -	struct buffer_head *bh = loc->xl_storage;
> -
> -	BUG_ON(offset >= bh->b_size);
> -	return bh->b_data + offset;
> +	return (char *)loc->xl_header + offset;
>  }
>  
>  static int ocfs2_xa_block_can_reuse(struct ocfs2_xa_loc *loc,
> @@ -1712,8 +1710,7 @@ static void *ocfs2_xa_bucket_offset_pointer(struct ocfs2_xa_loc *loc,
>  	struct ocfs2_xattr_bucket *bucket = loc->xl_storage;
>  	int block, block_offset;
>  
> -	BUG_ON(offset >= OCFS2_XATTR_BUCKET_SIZE);
> -
> +	/* The header is at the front of the bucket */
>  	block = offset >> loc->xl_inode->i_sb->s_blocksize_bits;
>  	block_offset = offset % loc->xl_inode->i_sb->s_blocksize;
>  
> 

  reply	other threads:[~2009-09-01  8:49 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-28  8:35 [Ocfs2-devel] [PATCH 0/14] ocfs2: Unify the setting of extended attributes Joel Becker
2009-08-28  8:35 ` [Ocfs2-devel] [PATCH 01/14] ocfs2: Introduce ocfs2_xa_loc Joel Becker
2009-09-01  5:32   ` Tao Ma
2009-09-01  8:26     ` Joel Becker
2009-09-01  8:45       ` Joel Becker
2009-09-01  8:49         ` Tao Ma [this message]
2009-08-28  8:35 ` [Ocfs2-devel] [PATCH 02/14] ocfs2: Remove xattrs via ocfs2_xa_loc Joel Becker
2009-09-01  6:03   ` Tao Ma
2009-09-01  8:28     ` Joel Becker
2009-08-28  8:35 ` [Ocfs2-devel] [PATCH 03/14] ocfs2: Prefix the member fields of struct ocfs2_xattr_info Joel Becker
2009-08-28  8:35 ` [Ocfs2-devel] [PATCH 04/14] ocfs2: Add a name_len field to ocfs2_xattr_info Joel Becker
2009-08-28  8:35 ` [Ocfs2-devel] [PATCH 05/14] ocfs2: Wrap calculation of name+value pair size Joel Becker
2009-08-28  8:35 ` [Ocfs2-devel] [PATCH 06/14] ocfs2: Set the xattr name+value pair in one place Joel Becker
2009-09-01  7:33   ` Tao Ma
2009-09-01  8:30     ` Joel Becker
2009-09-01  8:47       ` Tao Ma
2009-09-01  9:30         ` Joel Becker
2009-09-01 12:12           ` Tao Ma
2009-08-28  8:35 ` [Ocfs2-devel] [PATCH 07/14] ocfs2: Handle value tree roots in ocfs2_xa_set_inline_value() Joel Becker
2009-08-28  8:35 ` [Ocfs2-devel] [PATCH 08/14] ocfs2: Provide ocfs2_xa_fill_value_buf() for external value processing Joel Becker
2009-08-28  8:35 ` [Ocfs2-devel] [PATCH 09/14] ocfs2: Teach ocfs2_xa_loc how to do its own journal work Joel Becker
2009-08-28  8:35 ` [Ocfs2-devel] [PATCH 10/14] ocfs2: Allocation in ocfs2_xa_prepare_entry() values in ocfs2_xa_store_value() Joel Becker
2009-09-01  8:55   ` Tao Ma
2009-09-01 20:21     ` Joel Becker
2009-09-02  1:51       ` Joel Becker
2009-09-02  4:59         ` Tao Ma
2009-09-02  8:05           ` Joel Becker
2009-09-02  8:37           ` Joel Becker
2009-09-02  9:01             ` tristan.ye
2009-09-02 10:24               ` Joel Becker
2009-09-02 10:31                 ` Joel Becker
2009-09-03 10:48             ` tristan.ye
2009-09-05  1:35               ` Joel Becker
2009-09-08  1:25                 ` tristan.ye
2009-08-28  8:36 ` [Ocfs2-devel] [PATCH 11/14] ocfs2: Gell into ocfs2_xa_set() Joel Becker
2009-08-28  8:36 ` [Ocfs2-devel] [PATCH 12/14] ocfs2: Let ocfs2_xa_prepare_entry() do space checks Joel Becker
2009-09-02  1:54   ` Tao Ma
2009-09-02  2:11     ` Joel Becker
2009-09-02  2:21       ` Tao Ma
2009-08-28  8:36 ` [Ocfs2-devel] [PATCH 13/14] ocfs2: Set xattr block entries with ocfs2_xa_set() Joel Becker
2009-09-02  2:50   ` Tao Ma
2009-08-28  8:36 ` [Ocfs2-devel] [PATCH 14/14] ocfs2: Set inline xattr " Joel Becker
2009-09-02  2:58   ` Tao Ma
  -- strict thread matches above, loose matches on Subject: below --
2009-08-19 19:54 [Ocfs2-devel] [PATCH 0/14] ocfs2: Unify the setting of extended attributes Joel Becker
2009-08-19 19:54 ` [Ocfs2-devel] [PATCH 01/14] ocfs2: Introduce ocfs2_xa_loc Joel Becker
2009-08-27  7:48   ` Tao Ma
2009-08-27  9:28     ` 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=4A9CE030.4070605@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.