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] ocfs2: Make xattr reflink work with new local alloc reservation.
Date: Fri, 09 Jul 2010 12:03:15 +0800	[thread overview]
Message-ID: <4C369F83.7050306@oracle.com> (raw)
In-Reply-To: <20100708194224.GE17445@mail.oracle.com>



On 07/09/2010 03:42 AM, Joel Becker wrote:
> On Fri, Jun 18, 2010 at 11:02:51AM +0800, Tao Ma wrote:
>> +	num_buckets = le16_to_cpu(bucket_xh(args->old_bucket)->xh_num_buckets);
>> +	ocfs2_xattr_bucket_relse(args->old_bucket);
>> +
>> +	while (len&&  num_buckets) {
>> +		ret = ocfs2_claim_clusters(handle, data_ac,
>> +					   1,&p_cluster,&num_clusters);
>> +		if (ret) {
>> +			mlog_errno(ret);
>> +			goto out;
>> +		}
>> +
>> +		new_blkno = ocfs2_clusters_to_blocks(inode->i_sb, p_cluster);
>> +		reflink_buckets = num_buckets<  bpc * num_clusters ?
>> +				  num_buckets : bpc * num_clusters;
>
> 	I don't get this check.  In
> ocfs2_lock_reflink_xattr_rec_allocators(), we've reserved exactly enough
> clusters for the xattr rec.  ocfs2_claim_clusters() may return less than
> that, but in the optimal case it will return the entire len.  So...
> 	Ok, I think I get it.  I was trying to figure out if you were
> leaking clusters.  This check reflects that a cluster may contain
> multiple buckets, but not all buckets may be used yet.  Correct me if
> I'm wrong about the following limits:
>
> 	BUG_ON(num_buckets<  (bpc * (len - 1)));
> 	BUG_ON(num_buckets>  (bpc * len));
>
> You don't have to add those BUG_ON() calls to the code; I'm just
> confirming the range as I understand it.
yes, you are right. so num_buckets is originally set to the total bucket 
number for the clusters. But maybe there are several unused, and maybe 
we can't allocate enough contiguous clusters at a time. So we just CoW 
the minimal value of buckets.
> 	With that knowledge, your code is saying: "I have num_buckets to
> reflink, did I get enough clusters to do them all, or do I just use the
> entire range I got?"
> 	I think we should be more explicit.  Something like:
>
> 		reflink_buckets = num_buckets;
> 		if (reflink_buckets<  (bpc * num_clusters))
> 			reflink_buckets = bpc * num_clusters;
>
> This way speaks the intention.  I'd also be fine with:
>
> 		reflink_buckets = min(num_buckets, bpc * num_clusters);
I will use this line. thanks for the review.

Regards,
Tao

  reply	other threads:[~2010-07-09  4:03 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-18  3:00 [Ocfs2-devel] [PATCH 0/2] ocfs2: make xattr work with new local alloc reservation Tao Ma
2010-06-18  3:02 ` [Ocfs2-devel] [PATCH] ocfs2: make xattr extension " Tao Ma
2010-07-08 18:36   ` Joel Becker
2010-07-08 18:51   ` Joel Becker
2010-07-09  3:38     ` Tao Ma
2010-07-09  8:01       ` Joel Becker
2010-06-18  3:02 ` [Ocfs2-devel] [PATCH] ocfs2: Make xattr reflink " Tao Ma
2010-06-18  3:29   ` [Ocfs2-devel] [PATCH v2] " Tao Ma
2010-07-08 19:42   ` [Ocfs2-devel] [PATCH] " Joel Becker
2010-07-09  4:03     ` Tao Ma [this message]
2010-07-08 18:27 ` [Ocfs2-devel] [PATCH 0/2] ocfs2: make xattr " 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=4C369F83.7050306@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.