Re: [PATCH] ext4: fix inconsistent between segment fstrim and full fstrim

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

 



Remembered one more thing to note:

On Fri 15-12-23 12:11:08, Jan Kara wrote:
> On Thu 14-12-23 21:06:46, yebin (H) wrote:
> > On 2023/12/14 16:58, Jan Kara wrote:
> > > On Thu 14-12-23 14:46:35, Ye Bin wrote:
> > > > There will not issue discard cmd when do segment fstrim for ext4 fs, however,
> > > > if full fstrim for the same fs will issue discard cmd.
> > > > Above issue may happens as follows:
> > > > Precondition:
> > > > 1. Fstrim range [0, 15] and [16, 31];
> > > > 2. Discard granularity is 16;
> > > >              Range1          Range2
> > > >        1111000000000000 0000111010101011
> > > > There's no free space length large or equal than 16 in 'Range1' or 'Range2'.
> > > > As ext4_try_to_trim_range() only search free space among range which user
> > > > specified. However, there's maximum free space length 16 in 'Range1'+ 'Range2'.
> > > > To solve above issue, we need to find the longest free space to discard.
> > > > 
> > > > Signed-off-by: Ye Bin <yebin10@xxxxxxxxxx>
> > > OK, I agree that there is this behavioral difference. However is that a
> > > practical problem? I mean I would not expect the range to be particularly
> > > small, rather something like 1GB and then these boundary conditions don't
> > > really matter. This is also sensible so that we can properly track whether
> > > the whole block group was trimmed or not. Finally I'd also argue that
> > > trimming outside of specified range might be unexpected for the user. So a
> > > *fix* for this in my opinion lays in userspace which needs to select
> > > sensible ranges to use for trimming.
> > > 
> > > 								Honza
> > Thanks for your reply.
>
> > Our product fstrim entire file system, found to take a long time, thus
> > affecting other processes.  So they want to segment the file system
> > fstrim based on the IO of the system. But they found that fragmented
> > fstrims didn't work the same as fstrim  for the entire file system.

So I agree that trimming the whole fs at once may take too long. But also
note that if you make ranges smaller than block group size (128MB with 4k
block size), then we will never record that the group has been fully
trimmed and thus we will always trim all free extents in a group even
though there was no allocation there since the last trim. So in this sense
trims split to small ranges will not be equivalent to a large trim even
after your change.

> > Users do not know the distribution of free blocks in the file system,
> > and they do not know the reasonable range. The user's simple perception
> > is that the effect of segmented fstrim and full fstrim should be
> > consistent.

Personally I don't see a good reason to make trim range smaller than 1GB,
it just adds overhead, but I understand it may be a bit surprising.

								Honza
-- 
Jan Kara <jack@xxxxxxxx>
SUSE Labs, CR




[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux