Re: [PATCH V2] block: loop:use kstatfs.f_bsize of backing file to set discard granularity

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

 



On Tue, Jan 25, 2022 at 07:10:57AM +0100, Christoph Hellwig wrote:
> On Tue, Jan 25, 2022 at 12:40:05PM +0800, Ming Lei wrote:
> >  	} else {
> > +		struct kstatfs sbuf;
> > +
> >  		max_discard_sectors = UINT_MAX >> 9;
> > -		granularity = inode->i_sb->s_blocksize;
> > +		if (!vfs_statfs(&file->f_path, &sbuf))
> > +			granularity = sbuf.f_bsize;
> > +		else
> > +			granularity = PAGE_SIZE;
> 
> If vfs_statfs fails we're pretty much toast and there isn't really any
> point in continuing here.

But it is configure code path, even though vfs_statfs() fails,
loop_config_discard() still need to keep discard setting consistent.

Setting granularity as PAGE_SIZE is just for making discard granularity
matched with max_discard_sectors. Or you have better/simpler handling?


Thanks,
Ming




[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