Re: [PATCH v6] fat: Batched discard support for fat

Lukas Czerner
2011-05-24T13:30:35Z

On Tue, 24 May 2011, OGAWA Hirofumi wrote:

> Lukas Czerner <lczerner@redhat.com> writes:
>
> >> Are you read my email? So, FAT adjust 2 blocks, ext* 1 block, and what
> >> is other? The middle was guaranteed as continued? So, which is end of
> >> blocks?
> >
> > I am sorry but I am not sure what you are asking for. Just grab the size
> > of the file system or even better the size of underlying device (since
> > the filesyste would not be bigger than that) and use that.
> >
> > Of course if you grab the count of filesystem blocks (and the file
> > system does not account for the first data block) you'll end up with len
> > smaller than first data block. So it might make sense to not to
> > decrement the len and just start from first data block since it is not
> > accounted for anyway. However it is not a big deal, is it ? Are you
> > expecting any problems with this behaviour ?
>
> What is size of file system or underlying devices? You force to find the
> device which target FS is using? Even if you can get size of underlying
> devices, you force to user to insane loop in size of devices?

Look, I do not have time to argue with you forever and I do not even
understand what is your point. Just go and read other filesystems
implementation of FITRIM (ext4,ext3,xfs,btrfs?) and you'll see what you
need to do.

If you do not want to get the file system size, then FINE! just pass the
damn UULONG_MAX as length. I have no clue what insane loop are you
talking about! It is *easy* just discard the whole thing (with
UULONG_MAX) or, if you want to do it per-partes, then do it as long as
it does not return EINVAL, once it does you know that your "start" is
out of the filesystem and you are done!

>
> Why can you guarantee it's not big deal in design? Why can't you admit
> userland can't make optimized loop?

And what do you mean by that ?

-Lukas