mirror of
https://gitee.com/bianbu-linux/linux-6.6-fh
synced 2025-04-24 20:27:07 -04:00
block: remove QUEUE_FLAG_DISCARD
Just use a non-zero max_discard_sectors as an indicator for discard support, similar to what is done for write zeroes. The only places where needs special attention is the RAID5 driver, which must clear discard support for security reasons by default, even if the default stacking rules would allow for it. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com> Acked-by: Christoph Böhmwalder <christoph.boehmwalder@linbit.com> [drbd] Acked-by: Jan Höppner <hoeppner@linux.ibm.com> [s390] Acked-by: Coly Li <colyli@suse.de> [bcache] Acked-by: David Sterba <dsterba@suse.com> [btrfs] Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com> Link: https://lore.kernel.org/r/20220415045258.199825-25-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
cf0fbf894b
commit
70200574cc
61 changed files with 73 additions and 244 deletions
|
@ -133,7 +133,7 @@ static int fat_ioctl_fitrim(struct inode *inode, unsigned long arg)
|
|||
if (!capable(CAP_SYS_ADMIN))
|
||||
return -EPERM;
|
||||
|
||||
if (!blk_queue_discard(q))
|
||||
if (!bdev_max_discard_sectors(sb->s_bdev))
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
user_range = (struct fstrim_range __user *)arg;
|
||||
|
|
|
@ -1872,13 +1872,9 @@ int fat_fill_super(struct super_block *sb, void *data, int silent, int isvfat,
|
|||
goto out_fail;
|
||||
}
|
||||
|
||||
if (sbi->options.discard) {
|
||||
struct request_queue *q = bdev_get_queue(sb->s_bdev);
|
||||
if (!blk_queue_discard(q))
|
||||
fat_msg(sb, KERN_WARNING,
|
||||
"mounting with \"discard\" option, but "
|
||||
"the device does not support discard");
|
||||
}
|
||||
if (sbi->options.discard && !bdev_max_discard_sectors(sb->s_bdev))
|
||||
fat_msg(sb, KERN_WARNING,
|
||||
"mounting with \"discard\" option, but the device does not support discard");
|
||||
|
||||
fat_set_state(sb, 1, 0);
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue