[PATCH 02/10] block: move discard checks into the ioctl handler
Christoph Hellwig
hch at lst.de
Fri Mar 8 07:22:44 PST 2024
On Fri, Mar 08, 2024 at 08:33:08AM +1100, Dave Chinner wrote:
> > static int blk_ioctl_discard(struct block_device *bdev, blk_mode_t mode,
> > unsigned long arg)
> > {
> > + sector_t bs_mask = (bdev_logical_block_size(bdev) >> SECTOR_SHIFT) - 1;
> > + sector_t sector, nr_sects;
>
> This changes the alignment checks from a hard coded 512 byte sector
> to the logical block size of the device. I don't see a problem with
> this (it fixes a bug) but it should at least be mentioned in the
> commit message.
Before the exact block size alignment check as done down in
__blkdev_issue_discard, it just moves up here now. I guess I need to
make that more clear in the commit message.
More information about the Linux-nvme
mailing list