All of lore.kernel.org
 help / color / mirror / Atom feed
From: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
To: Kyungmin Park <kmpark@infradead.org>
Cc: Arnd Bergmann <arnd@arndb.de>,
	Lukas Czerner <lczerner@redhat.com>,
	linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH v6] fat: Batched discard support for fat
Date: Tue, 24 May 2011 15:39:22 +0900	[thread overview]
Message-ID: <87r57ok3fp.fsf@devron.myhome.or.jp> (raw)
In-Reply-To: <BANLkTi=7C3Lv2WkPoZzBCh2S87cVFcbp3Q@mail.gmail.com> (Kyungmin Park's message of "Tue, 24 May 2011 14:21:50 +0900")

Kyungmin Park <kmpark@infradead.org> writes:

>>> Do you still object to merge this feature for .40? As I said the
>>> batched discard design is out-of-scope of this patch.
>>> It's implemented at other batched discard, ext4, xfs and so on.
>>>
>>> I hope fat is also support the batched discard.
>>>
>>> Any opinions?
>>
>> I'm also thinking implementing this is good though. Sorry, I'm not going
>> to apply this for now, and would like to wait to be used by real
>> userland (I hope guys notice the problem, or userland tackles it somehow
>> sadly).
>>
>> I think, to expose the wrong behavior like this would be worse.
>>
>> E.g. one of problems, userland might do like this (trim chunk from 0 to
>> number of block)
>>
>> for chunk in number_of_blocks
>>        do_trim chunk
>> done
>
> It's handled at trim implementation. It just trim the fat aware block.
> Not trim the blocks which fat doesn't know.
> As fat don't use the block 0, 1, it adjust the start block at kernel.
>
> +       if (start < FAT_START_ENT)
> +               start = FAT_START_ENT;
>
> and don't exceed the max cluster size.
>
> +       len = (len > sbi->max_cluster) ? sbi->max_cluster : len;
>
> +       for (count = start; count <= len; count++) {

Yes. We _adjust_ from 0 to 2 here, so, the end of block also have to be
_adjusted_.

>From other point of view, if userland specified 0 - max-length
(i.e. number of blocks), what happens? It would trim block of 2 -
(max-length - 2), right?

So, actually, userland specify 2 - (max-length + 2). And userland has to
know 2 is real start, not 0.

But how to know it? Yes, it's FS internal layout, AFAICS, other FSes also
expose internal like this.

>> But this is actually wrong, this interface doesn't map blocks to 0-max,
>> so userland have to know real maximum-block-number somehow for each FS
>> (and maybe have to know real minimum-block-number).
>>
>> So, how to fix this? The solutions would be userland workaround, or fix
>> kernel. If it was userland, userland have to know FS internal sadly. If
>> it was kernel, we would have backward compatible nightmare, or ignore
>> compatible :(.
>
> I think basic concept of batched discard is trim at once instead of
> deleted entries at filesystem (original one).
> So it can set the specific start address or any start (usually 0) with
> maximum length.

Yes, I think so too (i.e. 0 - max length). But the implement is not
working like it. It exposes FS internal layout.

>> I really think we have to rethink this and have agreement about common
>> interface. Or there was real userland app, I think FAT can implement to
>> work that app.
>
> IMO, we should use the same user space application. user program
> doesn't know the which filesystem are underlying.

Indeed.

> So sample user space program used at ext4, xfs should be used. and I
> tested it.

I bet it doesn't trim whole FS (due to expose FS layout) actually even
if user asked like above example.

Thanks.
-- 
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>

WARNING: multiple messages have this Message-ID (diff)
From: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
To: Kyungmin Park <kmpark@infradead.org>
Cc: Arnd Bergmann <arnd@arndb.de>,
	Lukas Czerner <lczerner@redhat.com>,
	linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH v6] fat: Batched discard support for fat
Date: Tue, 24 May 2011 15:39:22 +0900	[thread overview]
Message-ID: <87r57ok3fp.fsf@devron.myhome.or.jp> (raw)
In-Reply-To: <BANLkTi=7C3Lv2WkPoZzBCh2S87cVFcbp3Q@mail.gmail.com> (Kyungmin Park's message of "Tue, 24 May 2011 14:21:50 +0900")

Kyungmin Park <kmpark@infradead.org> writes:

>>> Do you still object to merge this feature for .40? As I said the
>>> batched discard design is out-of-scope of this patch.
>>> It's implemented at other batched discard, ext4, xfs and so on.
>>>
>>> I hope fat is also support the batched discard.
>>>
>>> Any opinions?
>>
>> I'm also thinking implementing this is good though. Sorry, I'm not going
>> to apply this for now, and would like to wait to be used by real
>> userland (I hope guys notice the problem, or userland tackles it somehow
>> sadly).
>>
>> I think, to expose the wrong behavior like this would be worse.
>>
>> E.g. one of problems, userland might do like this (trim chunk from 0 to
>> number of block)
>>
>> for chunk in number_of_blocks
>>        do_trim chunk
>> done
>
> It's handled at trim implementation. It just trim the fat aware block.
> Not trim the blocks which fat doesn't know.
> As fat don't use the block 0, 1, it adjust the start block at kernel.
>
> +       if (start < FAT_START_ENT)
> +               start = FAT_START_ENT;
>
> and don't exceed the max cluster size.
>
> +       len = (len > sbi->max_cluster) ? sbi->max_cluster : len;
>
> +       for (count = start; count <= len; count++) {

Yes. We _adjust_ from 0 to 2 here, so, the end of block also have to be
_adjusted_.

From other point of view, if userland specified 0 - max-length
(i.e. number of blocks), what happens? It would trim block of 2 -
(max-length - 2), right?

So, actually, userland specify 2 - (max-length + 2). And userland has to
know 2 is real start, not 0.

But how to know it? Yes, it's FS internal layout, AFAICS, other FSes also
expose internal like this.

>> But this is actually wrong, this interface doesn't map blocks to 0-max,
>> so userland have to know real maximum-block-number somehow for each FS
>> (and maybe have to know real minimum-block-number).
>>
>> So, how to fix this? The solutions would be userland workaround, or fix
>> kernel. If it was userland, userland have to know FS internal sadly. If
>> it was kernel, we would have backward compatible nightmare, or ignore
>> compatible :(.
>
> I think basic concept of batched discard is trim at once instead of
> deleted entries at filesystem (original one).
> So it can set the specific start address or any start (usually 0) with
> maximum length.

Yes, I think so too (i.e. 0 - max length). But the implement is not
working like it. It exposes FS internal layout.

>> I really think we have to rethink this and have agreement about common
>> interface. Or there was real userland app, I think FAT can implement to
>> work that app.
>
> IMO, we should use the same user space application. user program
> doesn't know the which filesystem are underlying.

Indeed.

> So sample user space program used at ext4, xfs should be used. and I
> tested it.

I bet it doesn't trim whole FS (due to expose FS layout) actually even
if user asked like above example.

Thanks.
-- 
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2011-05-24  6:39 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-28 10:34 [PATCH v6] fat: Batched discard support for fat Kyungmin Park
2011-03-29  5:04 ` OGAWA Hirofumi
2011-03-29  5:11   ` Kyungmin Park
2011-03-29  5:11     ` Kyungmin Park
2011-03-29  6:37     ` OGAWA Hirofumi
2011-03-29  6:42       ` Kyungmin Park
2011-03-29  7:28         ` OGAWA Hirofumi
2011-03-30 13:22 ` Arnd Bergmann
2011-03-30 13:50   ` Lukas Czerner
2011-03-30 13:58     ` Kyungmin Park
2011-03-30 14:45       ` Arnd Bergmann
2011-03-30 14:20     ` Arnd Bergmann
2011-03-30 14:44       ` Kyungmin Park
2011-03-30 15:06         ` Arnd Bergmann
2011-05-24  1:18           ` Kyungmin Park
2011-05-24  4:47             ` OGAWA Hirofumi
2011-05-24  5:21               ` Kyungmin Park
2011-05-24  6:39                 ` OGAWA Hirofumi [this message]
2011-05-24  6:39                   ` OGAWA Hirofumi
2011-05-24  6:55                   ` Kyungmin Park
2011-05-24  7:32                     ` OGAWA Hirofumi
2011-05-24  8:54                       ` Kyungmin Park
2011-05-24  9:44                         ` OGAWA Hirofumi
2011-05-24  9:25                       ` Lukas Czerner
2011-05-24 10:07                         ` OGAWA Hirofumi
2011-05-24 10:44                           ` Lukas Czerner
2011-05-24 11:14                             ` OGAWA Hirofumi
2011-05-24 11:32                               ` Lukas Czerner
2011-05-24 12:19                                 ` OGAWA Hirofumi
2011-05-24 13:30                                   ` Lukas Czerner
2011-05-24 14:19                                     ` OGAWA Hirofumi
2011-08-31 13:02                                       ` Kyungmin Park
2011-08-31 17:51                                         ` OGAWA Hirofumi
2011-10-05 14:38                                           ` Lukas Czerner
  -- strict thread matches above, loose matches on Subject: below --
2017-06-15 16:10 Alex Ivanov
2017-06-16  1:50 ` OGAWA Hirofumi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87r57ok3fp.fsf@devron.myhome.or.jp \
    --to=hirofumi@mail.parknet.co.jp \
    --cc=arnd@arndb.de \
    --cc=kmpark@infradead.org \
    --cc=lczerner@redhat.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.