diff options
author | Ming Lei <[email protected]> | 2022-01-26 11:58:30 +0800 |
---|---|---|
committer | Jens Axboe <[email protected]> | 2022-02-11 15:10:49 -0700 |
commit | 06582bc86d7f48d35cd044098ca1e246e8c7c52e (patch) | |
tree | d6038c855d863a83b254063fd3f6bea8887a1bad /scripts/gdb/linux | |
parent | a12821d5e012a42673f6fe521971f193441d8aa4 (diff) |
block: loop:use kstatfs.f_bsize of backing file to set discard granularity
If backing file's filesystem has implemented ->fallocate(), we think the
loop device can support discard, then pass sb->s_blocksize as
discard_granularity. However, some underlying FS, such as overlayfs,
doesn't set sb->s_blocksize, and causes discard_granularity to be set as
zero, then the warning in __blkdev_issue_discard() is triggered.
Christoph suggested to pass kstatfs.f_bsize as discard granularity, and
this way is fine because kstatfs.f_bsize means 'Optimal transfer block
size', which still matches with definition of discard granularity.
So fix the issue by setting discard_granularity as kstatfs.f_bsize if it
is available, otherwise claims discard isn't supported.
Cc: Christoph Hellwig <[email protected]>
Cc: Vivek Goyal <[email protected]>
Reported-by: Pei Zhang <[email protected]>
Signed-off-by: Ming Lei <[email protected]>
Reviewed-by: Christoph Hellwig <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jens Axboe <[email protected]>
Diffstat (limited to 'scripts/gdb/linux')
0 files changed, 0 insertions, 0 deletions