mirror of
https://gitee.com/bianbu-linux/linux-6.6-fh
synced 2025-04-24 20:27:07 -04:00
block: add a bdev_discard_granularity helper
Abstract away implementation details from file systems by providing a block_device based helper to retrieve the discard granularity. 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: Ryusuke Konishi <konishi.ryusuke@gmail.com> Acked-by: David Sterba <dsterba@suse.com> [btrfs] Link: https://lore.kernel.org/r/20220415045258.199825-26-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
70200574cc
commit
7b47ef52d0
18 changed files with 38 additions and 47 deletions
|
@ -127,7 +127,6 @@ static int fat_ioctl_fitrim(struct inode *inode, unsigned long arg)
|
|||
struct super_block *sb = inode->i_sb;
|
||||
struct fstrim_range __user *user_range;
|
||||
struct fstrim_range range;
|
||||
struct request_queue *q = bdev_get_queue(sb->s_bdev);
|
||||
int err;
|
||||
|
||||
if (!capable(CAP_SYS_ADMIN))
|
||||
|
@ -141,7 +140,7 @@ static int fat_ioctl_fitrim(struct inode *inode, unsigned long arg)
|
|||
return -EFAULT;
|
||||
|
||||
range.minlen = max_t(unsigned int, range.minlen,
|
||||
q->limits.discard_granularity);
|
||||
bdev_discard_granularity(sb->s_bdev));
|
||||
|
||||
err = fat_trim_fs(inode, &range);
|
||||
if (err < 0)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue