Re: [PATCH 01/18] btrfs: Remove u64 conversion for PAGE_CACHE_SIZE

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

 



On Thu, Mar 25, 2010 at 08:27:26PM +0800, Miao Xie wrote:
> From: Zhao Lei <zhaolei@xxxxxxxxxxxxxx>
> 
> We don't need to convert PAGE_CACHE_SIZE to u64 in bit operation.

For code like this:

u64 size = (some number that doesn't fit in 32 bits)

if (size & (PAGE_CACHE_SIZE - 1)) {
}

The answer should be the same either way.  But if the code gets
switched:

start = size & ~(PAGE_CACHE_SIZE - 1);

Some arches are going to get the wrong answer here.  We had a few bugs
like this early on and I went through and casted everything to be
consistent.  While this patch is correct, I would rather leave the casts
to avoid subtle problems later on as the code changes.

-chris

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux