block: Move SECTOR_SIZE and SECTOR_SHIFT definitions into <linux/blkdev.h>
authorBart Van Assche <bart.vanassche@wdc.com>
Wed, 14 Mar 2018 22:48:06 +0000 (15:48 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 12 Sep 2020 09:47:36 +0000 (11:47 +0200)
commitd24c407b0f7af675a3928fdd4121306ad32c60ab
tree0c1d4c52b53a17bec02d3c814d4110ae116e0c50
parent0c7cee63ec92b316f8b891b667177a080b670566
block: Move SECTOR_SIZE and SECTOR_SHIFT definitions into <linux/blkdev.h>

commit 233bde21aa43516baa013ef7ac33f3427056db3e upstream.

It happens often while I'm preparing a patch for a block driver that
I'm wondering: is a definition of SECTOR_SIZE and/or SECTOR_SHIFT
available for this driver? Do I have to introduce definitions of these
constants before I can use these constants? To avoid this confusion,
move the existing definitions of SECTOR_SIZE and SECTOR_SHIFT into the
<linux/blkdev.h> header file such that these become available for all
block drivers. Make the SECTOR_SIZE definition in the uapi msdos_fs.h
header file conditional to avoid that including that header file after
<linux/blkdev.h> causes the compiler to complain about a SECTOR_SIZE
redefinition.

Note: the SECTOR_SIZE / SECTOR_SHIFT / SECTOR_BITS definitions have
not been removed from uapi header files nor from NAND drivers in
which these constants are used for another purpose than converting
block layer offsets and sizes into a number of sectors.

Cc: David S. Miller <davem@davemloft.net>
Cc: Mike Snitzer <snitzer@redhat.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Nitin Gupta <ngupta@vflare.org>
Reviewed-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 files changed:
arch/xtensa/platforms/iss/simdisk.c
drivers/block/brd.c
drivers/block/rbd.c
drivers/block/zram/zram_drv.h
drivers/ide/ide-cd.c
drivers/ide/ide-cd.h
drivers/nvdimm/nd.h
drivers/scsi/gdth.h
include/linux/blkdev.h
include/linux/device-mapper.h
include/linux/ide.h
include/uapi/linux/msdos_fs.h