[Btrfs-devel][PATCH]Minor fix for btrfs_csum_file_block.
Chris Mason
chris.mason at oracle.com
Tue Oct 30 09:19:53 PDT 2007
On Tue, 30 Oct 2007 07:13:46 +0800
"Yan Zheng" <yanzheng at 21cn.com> 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'
In this case, we're calculating the number of csums we're going to
insert, and so it should include the csum for the block we were
passed. So, tmp -= offset is correct. The extra alignment is mostly
paranoia.
-chris
More information about the Btrfs-devel
mailing list