[PATCH 02/10] block: move discard checks into the ioctl handler
Dave Chinner
david at fromorbit.com
Fri Mar 8 13:16:36 PST 2024
On Fri, Mar 08, 2024 at 04:22:44PM +0100, Christoph Hellwig wrote:
> 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.
Ah, eyeball pattern matching fail on my part - you changed it from a
hard coded '9' to SECTOR_SHIFT as it moved (which is fine!), I just
missed that. All good!
-Dave.
--
Dave Chinner
david at fromorbit.com
More information about the Linux-nvme
mailing list