Re: [PATCH] block: loop: set discard_granularity as PAGE_SIZE if sb->s_blocksize is 0

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jan 24, 2022 at 06:05:07AM -0800, Christoph Hellwig wrote:
> On Mon, Jan 24, 2022 at 06:06:28PM +0800, Ming Lei wrote:
> > 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.
> > 
> > Fix the issue by setting discard_granularity as PAGE_SIZE in this case
> > since PAGE_SIZE is the most common data unit for FS.
> 
> sb->s_blocksize really does not mean anything.  kstat.blksize might
> be a better choice, even if it someimes errs on the too large side.

[ CC linux-unionfs, Miklos ]

This should work well for overlayfs too. I see it just passes the query
to underlying filesystem and that should report optimal I/O size.

On my overlayfs instance, I see.

# stat -c '%o' foo.txt
4096

Vivek




[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux