lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Message-ID: <20230421093940.k2crghkblpx2fqlv@quack3> Date: Fri, 21 Apr 2023 11:39:40 +0200 From: Jan Kara <jack@...e.cz> To: Chao Yu <chao@...nel.org> Cc: Theodore Ts'o <tytso@....edu>, Andreas Dilger <adilger.kernel@...ger.ca>, linux-ext4@...r.kernel.org, linux-kernel@...r.kernel.org Subject: Re: [PATCH v2] ext4: fix to report fstrim.minlen back to userspace On Thu 06-04-23 23:04:10, Chao Yu wrote: > Quoted from manual of fstrim(8): > > "-m, --minimum minimum-size > ..., if it's smaller than the device's minimum, and report that > (fstrim_range.minlen) back to userspace." > > So this patch tries to report adjusted fstrim_range.minlen back to > userspace via FITRIM interface, if the value is smaller than device's > minimum discard granularity. > > Signed-off-by: Chao Yu <chao@...nel.org> Looks good to me. Feel free to add: Reviewed-by: Jan Kara <jack@...e.cz> Honza > --- > v2: > - fix the wrong calculation of range->minlen. > fs/ext4/mballoc.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c > index d8b9d6a83d1e..4af51a16fc64 100644 > --- a/fs/ext4/mballoc.c > +++ b/fs/ext4/mballoc.c > @@ -6491,6 +6491,10 @@ int ext4_trim_fs(struct super_block *sb, struct fstrim_range *range) > discard_granularity >> sb->s_blocksize_bits); > if (minlen > EXT4_CLUSTERS_PER_GROUP(sb)) > goto out; > + > + /* Report adjusted minlen back to userspace */ > + range->minlen = EXT4_C2B(EXT4_SB(sb), minlen) << > + sb->s_blocksize_bits; > } > if (end >= max_blks - 1) { > end = max_blks - 1; > -- > 2.25.1 > -- Jan Kara <jack@...e.com> SUSE Labs, CR
Powered by blists - more mailing lists