On 7/25/14, 12:25 PM, Eric Sandeen wrote:
> On 7/25/14, 12:12 PM, Zach Brown wrote:
>> On Thu, Jul 24, 2014 at 11:27:32PM -0500, Eric Sandeen wrote:
>>> make_btrfs() rounds down the first device size to a multiple of sectorsize:
>>
>>                ^^^^^^^^^^^
>>
>>> -   device->total_bytes = block_count;
>>> +   device->total_bytes = (block_count / sectorsize) * sectorsize;
>>
>> kerncompat.h:#define round_down(x, y) ((x) & ~__round_mask(x, y))
>>
>> - z
>>
> 
> yeah yeah ;) this isn't copied kernel code but sure, that'd be better.
> 
> I'm trying to clean up this whole "we say blocks when we mean bytes!"
> thing, and I'll include round_down() as well.

meh.  And half this is done in kernelspace for device add/replace
(device size setting etc) so TBH I'm increasingly inclined to
just back away slowly here.  :(

(IOWs device_add calls btrfs_prepare_device(), but the size
it finds is never used; the kernel does:

        device->total_bytes = i_size_read(bdev->bd_inode);

so changing prepare_device doesn't catch add/replace cases...)

Perhaps the simpler option is to remove the rounding which is
only done on the first device added in userspace, but I honestly
don't know what the design plan is, or what the ramifications of
that might be ...

-Eric

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

Reply via email to