[btrfs-devel]A question about extent buffer codes
Chris Mason
chris.mason at oracle.com
Tue Oct 16 06:11:27 PDT 2007
On Tue, 2007-10-16 at 20:32 +0800, Yan Zheng wrote:
> Hello
>
> Some xxx_extent_buffer functions have codes like:
> --
> offset = dst_offset & ((unsigned long)PAGE_CACHE_SIZE - 1);
> if (i == 0)
> offset += start_offset;
>
> I can't understand why these is a test. I feel the variable 'offset'
> should be computed by code like:
> --
> offset = (dst_offset + start_offset) & ((unsigned
> long)PAGE_CACHE_SIZE - 1);
It could be offset = (dst->start + dst_offset) & PAGE_CACHE_SIZE - 1,
but start_offset is already the offset into the first page. So, we only
want to add it on the first page.
-chris
More information about the Btrfs-devel
mailing list