qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 2/5] qcow2: record fragmentation statistics duri


From: Stefan Hajnoczi
Subject: Re: [Qemu-devel] [PATCH 2/5] qcow2: record fragmentation statistics during check
Date: Wed, 6 Feb 2013 10:37:35 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

On Tue, Feb 05, 2013 at 02:36:08PM -0700, Eric Blake wrote:
> On 02/05/2013 11:54 AM, Stefan Hajnoczi wrote:
> > @@ -963,6 +965,17 @@ static int check_refcounts_l2(BlockDriverState *bs, 
> > BdrvCheckResult *res,
> >              l2_entry &= s->cluster_offset_mask;
> >              inc_refcounts(bs, res, refcount_table, refcount_table_size,
> >                  l2_entry & ~511, nb_csectors * 512);
> > +
> > +            if (flags & CHECK_FRAG_INFO) {
> > +                res->bfi.allocated_clusters++;
> > +                if (next_contiguous_offset &&
> > +                    (l2_entry & ~511) != next_contiguous_offset) {
> > +                    res->bfi.fragmented_clusters++;
> > +                }
> > +                /* Round down again, see nb_sectors above */
> > +                next_contiguous_offset = (l2_entry & ~511) +
> 
> That's a lot of repetition of (l2_entry & ~511), which feels somewhat
> magic; is it worth a dedicated temporary variable better named to
> explain why l2_entry is being rounded down to a 512-byte boundary?

You are right.  The rounding down is refers to nb_csectors, not
l2_entry.  I have added a comment to explain the reason.

Stefan



reply via email to

[Prev in Thread] Current Thread [Next in Thread]