lkml.org 
[lkml]   [2016]   [Dec]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    SubjectRe: [RFC] block: check partition alignment
    From
    Date

    > sd.c ensures that the logical block size (sector size in sd.c) is a
    > power of 2 between 512 and 4096. So you can use:
    >
    > if (p.start & (bdev_physical_block_size(bdev) - 1))

    Sorry, that was a little too short as a complete proof:
    sd.c ensures that the logical block size (sector size in sd.c) is a
    power of 2 between 512 and 4096, and the physical block size is a power
    of 2 number of logical blocks. So the physical block size is also always
    a power of 2.

    >
    > Or use div_u64_rem to avoid an error on 32 bits builds.
    >
    > Best regards.
    >

    --
    Damien Le Moal, Ph.D.
    Sr. Manager, System Software Research Group,
    Western Digital Corporation
    Damien.LeMoal@wdc.com
    (+81) 0466-98-3593 (ext. 513593)
    1 kirihara-cho, Fujisawa,
    Kanagawa, 252-0888 Japan
    www.wdc.com, www.hgst.com

    \
     
     \ /
      Last update: 2016-12-15 01:55    [W:4.763 / U:0.192 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site