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 09/13] ocfs2: Take ocfs2_xattr_bucket structures off of the stack.
Date: Tue, 28 Oct 2008 09:50:12 +0800	[thread overview]
Message-ID: <49066FD4.40809@oracle.com> (raw)
In-Reply-To: <1225156828-32189-10-git-send-email-joel.becker@oracle.com>



Joel Becker wrote:
> The ocfs2_xattr_bucket structure is a nice abstraction, but it is a bit
> large to have on the stack.  Just like ocfs2_path, let's allocate it
> with a ocfs2_xattr_bucket_new() function.
> 
> We can now store the inode on the bucket, cleaning up all the other
> bucket functions.  While we're here, we catch another place or two that
> wasn't using ocfs2_read_xattr_bucket().
> 
> Signed-off-by: Joel Becker <joel.becker@oracle.com>
> ---

> +
> +static void ocfs2_xattr_bucket_relse(struct ocfs2_xattr_bucket *bucket)
>  {
> -	int i, blks = ocfs2_blocks_per_xattr_bucket(inode->i_sb);
> +	int i;
>  
> -	for (i = 0; i < blks; i++) {
> +	for (i = 0; i < bucket->bu_blocks; i++) {
>  		brelse(bucket->bu_bhs[i]);
>  		bucket->bu_bhs[i] = NULL;
>  	}
>  }
>  
> +static void ocfs2_xattr_bucket_free(struct ocfs2_xattr_bucket *bucket)
> +{
> +	if (bucket) {
> +		ocfs2_xattr_bucket_relse(bucket);
> +		bucket->bu_inode = NULL;
we need "kfree(bucket)" here.
> +	}
> +}

Regards,
Tao

  reply	other threads:[~2008-10-28  1:50 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
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 [this message]
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=49066FD4.40809@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.