On Tue, Jun 16, 2015 at 6:20 AM, Vivek Goyal <vgoyal@xxxxxxxxxx> wrote: > On Mon, Jun 15, 2015 at 12:52:57PM -0700, Doug Dumitru wrote: >> > >> > - Is i_size_read(lc->src1dev->bdev->bd_inode) the correct way of >> > determining the size of the underlying block device? If not, which >> > function is? >> > > > I believe that's correct. Look at block/blk-core.c > > handle_bad_sector(struct bio *bio) > { > } > Kernel will call i_size_write to assign the device capacity, when the device try to be registered(register_disk). During the period of register, the function blkdev_get will call bd_set_size to set the capacity. So it is correct that you can call i_size_read to determine the device's capacity. >> >> ... I am happy to leave out answers that I don't know ... >> >> >> > >> > - Can I safely assume the logical sector size is fixed to be 512 bytes >> > in all cases? >> > >> >> Probably not, but maybe. You are in control of the hardware. > > You mean block size or sector size? I think sector sizes can vary and > targets can allow user space to specify one. Typically metadata is per > block can lead to smaller metadata foot print. > For now, the minimum align unit is 512 bytes. But as I know, a lot of devices start to support 4KB align unit. Please correct me if there is something wrong in the comment. Thanks Minfei -- dm-devel mailing list dm-devel@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/dm-devel