[Btrfs-devel][PATCH]Minor fix for btrfs_csum_file_block.

Steve Long slong at rathaus.eclipse.co.uk
Mon Oct 29 20:28:17 PDT 2007


On Monday 29 October 2007 23:13, Yan Zheng wrote:
> 2007/10/30, Chris Mason <chris.mason at oracle.com>:
> > I made one small change here:
> > > @@ -238,7 +236,7 @@ insert:
> > >       csum_offset = 0;
> > >       if (found_next) {
> > >               u64 tmp = min((u64)i_size_read(inode), next_offset);
> > > -             tmp -= offset + root->sectorsize - 1;
> > > +             tmp -= offset - root->sectorsize + 1;
> >
> >                 tmp -= offset & ~((u64)root->sectorsize - 1);
>
> 'offset' is already aligned to sector size,  so this line is
> equivalent to 'tmp -= offset'.   I think it's better change this line
> to 'tmp = tmp - offset + root->sectorsize - 1'
>
I agree it's clearer. (I'm assuming it's correct [it's the same as original 
patch.]) Clarity helps:when it's not immediately obvious, reword it if it 
doesn't affect performance (which this doesn't ofc.) Else comment it.

In this case I think a comment about alignment (whatever the code ends up 
being) would help.



More information about the Btrfs-devel mailing list