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 04/15] ocfs2/xattr: Reserve meta/data at the beginning of ocfs2_xattr_set.
Date: Fri, 07 Nov 2008 09:10:14 +0800	[thread overview]
Message-ID: <49139576.7070600@oracle.com> (raw)
In-Reply-To: <20081107001111.GE15154@wotan.suse.de>



Mark Fasheh wrote:
> On Thu, Oct 30, 2008 at 01:42:14PM +0800, Tao Ma wrote:
> 
>> @@ -1548,6 +1528,11 @@ static int ocfs2_remove_value_outside(struct inode*inode,
>>  				      struct ocfs2_xattr_header *header)
>>  {
>>  	int ret = 0, i;
>> +	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
>> +	struct ocfs2_xattr_set_ctxt ctxt;
>> +
>> +	memset(&ctxt, 0, sizeof(ctxt));
>> +	ocfs2_init_dealloc_ctxt(&ctxt.dealloc);
> 
> 
> You can lose the memset if you just do:
> 
> 	struct ocfs2_xattr_set_ctxt ctxt = { NULL, };
Sure. Thanks.
> 
>>  
>>  	for (i = 0; i < le16_to_cpu(header->xh_count); i++) {
>>  		struct ocfs2_xattr_entry *entry = &header->xh_entries[i];
> 
> 
>> +static int ocfs2_init_xattr_set_ctxt(struct inode *inode,
>> +				     struct ocfs2_dinode *di,
>> +				     struct ocfs2_xattr_info *xi,
>> +				     struct ocfs2_xattr_search *xis,
>> +				     struct ocfs2_xattr_search *xbs,
>> +				     struct ocfs2_xattr_set_ctxt *ctxt)
>> +{
> 
> This function looks suspiciously like ocfs2_lock_allocators()... That said,
> I think it's probably fine to leave it on it's own for now ;)
yeah, actually I refer to that function. ;) So maybe we can intergrate 
them later.
> 
> 
>> +	int clusters_add, meta_add, ret;
>> +	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
>> +
>> +	memset(ctxt, 0, sizeof(struct ocfs2_xattr_set_ctxt));
>> +
>> +	ocfs2_init_dealloc_ctxt(&ctxt->dealloc);
>> +
>> +	ret = ocfs2_calc_xattr_set_need(inode, di, xi, xis, xbs,
>> +					&clusters_add, &meta_add);
>> +	if (ret) {
>> +		mlog_errno(ret);
>> +		return ret;
>> +	}
>> +
>> +	mlog(0, "Set xattr %s, reserve meta blocks = %d, clusters = %d\n",
>> +	     xi->name, meta_add, clusters_add);
>> +
>> +	if (meta_add) {
>> +		ret = ocfs2_reserve_new_metadata_blocks(osb, meta_add,
>> +							&ctxt->meta_ac);
>> +		if (ret) {
>> +			mlog_errno(ret);
>> +			goto out;
>> +		}
>> +	}
> 
> 
>> @@ -2146,10 +2377,18 @@ int ocfs2_xattr_set(struct inode *inode,
>>  				 */
>>  				xi.value = NULL;
>>  				xi.value_len = 0;
>> -				ret = ocfs2_xattr_ibody_set(inode, &xi, &xis);
>> +				ret = ocfs2_xattr_ibody_set(inode, &xi,
>> +							    &xis, &ctxt);
>>  			}
>>  		}
>>  	}
>> +free:
>> +	if (ctxt.data_ac)
>> +		ocfs2_free_alloc_context(ctxt.data_ac);
>> +	if (ctxt.meta_ac)
>> +		ocfs2_free_alloc_context(ctxt.meta_ac);
>> +	ocfs2_schedule_truncate_log_flush(osb, 1);
> 
> Since this is a set function, which only a small part of the time will be
> deleteing clusters, I think it would be better not to unconditionally start
> a truncate log flush. Maybe you can do that only in the case where we have
> clusters to free?
No problem, it is easy for us to detect whether ctxt.dealloc has some 
clusters to free.

Regards,
Tao

  reply	other threads:[~2008-11-07  1:10 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-30 11:31 [Ocfs2-devel] [PATCH 00/15] ocfs2: add security EA and ACL support V4 Tiger Yang
2008-10-30  5:42 ` [Ocfs2-devel] [PATCH 01/15] ocfs2/xattr: Only extend xattr bucket in need Tao Ma
2008-11-06 19:45   ` Mark Fasheh
2008-11-07  1:05     ` Tao Ma
2008-10-30  5:42 ` [Ocfs2-devel] [PATCH 02/15] ocfs2: Add clusters free in dealloc_ctxt Tao Ma
2008-11-04  1:16   ` Joel Becker
2008-11-04  1:34     ` Tao Ma
2008-11-04  3:01       ` Joel Becker
2008-11-04  3:07         ` Tao Ma
2008-11-04  7:40         ` Joel Becker
2008-11-04 23:25     ` [Ocfs2-devel] [PATCH 02/15] ocfs2: Add clusters free in dealloc_ctxt.v2 Tao Ma
2008-11-05 22:25       ` Joel Becker
2008-11-06  6:08         ` Tao Ma
2008-10-30  5:42 ` [Ocfs2-devel] [PATCH 03/15] ocfs2/xattr: Move clusters free into dealloc Tao Ma
2008-11-04  3:17   ` Joel Becker
2008-10-30  5:42 ` [Ocfs2-devel] [PATCH 04/15] ocfs2/xattr: Reserve meta/data at the beginning of ocfs2_xattr_set Tao Ma
2008-11-07  0:11   ` Mark Fasheh
2008-11-07  1:10     ` Tao Ma [this message]
2008-10-30  5:42 ` [Ocfs2-devel] [PATCH 05/15] ocfs2/xattr: Merge xattr set transaction Tao Ma
2008-11-07 22:46   ` Joel Becker
2008-10-30 11:40 ` [Ocfs2-devel] [PATCH 06/15] ocfs2: move new_inode out of the transaction Tiger Yang
2008-11-07  1:02   ` Mark Fasheh
2008-10-30 11:40 ` [Ocfs2-devel] [PATCH 07/15] ocfs2: add ocfs2_xattr_set_handle Tiger Yang
2008-11-07  1:03   ` Mark Fasheh
2008-10-30 11:40 ` [Ocfs2-devel] [PATCH 08/15] ocfs2: add security xattr API Tiger Yang
2008-11-07  1:17   ` Mark Fasheh
2008-11-07  1:17     ` Mark Fasheh
2008-10-30 11:41 ` [Ocfs2-devel] [PATCH 09/15] ocfs2: add ocfs2_init_security in mkno Tiger Yang
2008-10-30 11:41 ` [Ocfs2-devel] [PATCH 10/15] ocfs2: add ocfs2_xattr_get_nolock Tiger Yang
2008-10-30 11:41 ` [Ocfs2-devel] [PATCH 11/15] ocfs2: add POSIX ACL API Tiger Yang
2008-11-07  1:26   ` Mark Fasheh
2008-10-30 11:41 ` [Ocfs2-devel] [PATCH 12/15] ocfs2: add ocfs2_check_acl Tiger Yang
2008-10-30 11:42 ` [Ocfs2-devel] [PATCH 13/15] ocfs2: add ocfs2_acl_chmod Tiger Yang
2008-11-07  1:33   ` Mark Fasheh
2008-10-30 11:42 ` [Ocfs2-devel] [PATCH 14/15] ocfs2: add ocfs2_init_acl in mknod Tiger Yang
2008-10-30 11:42 ` [Ocfs2-devel] [PATCH 15/15] ocfs2: add mount option and Kconfig option for acl Tiger Yang
2008-10-30 13:45 ` [Ocfs2-devel] [PATCH 00/15] ocfs2: add security EA and ACL support V4 Tao Ma

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=49139576.7070600@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.