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.