mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
To: Kyungmin Park <kmpark@infradead.org>
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	Lukas Czerner <lczerner@redhat.com>
Subject: Re: [PATCH v5] fat: Batched discard support for fat
Date: Mon, 28 Mar 2011 15:21:05 +0900	[thread overview]
Message-ID: <874o6n6a0e.fsf@devron.myhome.or.jp> (raw)
In-Reply-To: <AANLkTimxojxAKbOE6XYa5DctNMpU8ob4+eAG05iwN=3P@mail.gmail.com> (Kyungmin Park's message of "Mon, 28 Mar 2011 14:57:22 +0900")

Kyungmin Park <kmpark@infradead.org> writes:

>>> +     start = range->start >> sb->s_blocksize_bits;
>>> +     start = start / sbi->sec_per_clus;
>>
>> start is round-down, I think it's strange interface. E.g. user specified
>> the range as "start=10 len=1024". So the range should be 10-1034,
>> i.e. (assume cluster-size is 512) 512-1024, right?
>
> I don't know what's the correct way? If you're right. it's better to round-up.
> If cluster-size is 32KiB and start sector is in the middle of cluster,
> then which is better. round-down or round-up?

It depends on the design of this interface though, I bet it's round-up,
and should use same way with other FSes.

>>> +     minlen = range->minlen >> sb->s_blocksize_bits;
>>> +     minlen = minlen / sbi->sec_per_clus;
>>> +     trimmed = 0;
>>> +     count = 0;
>>> +     err = -EINVAL;
>>> +
>>> +     lock_fat(sbi);
>>> +     if (sbi->free_clusters != -1 && sbi->free_clus_valid)
>>> +             goto out;
>>
>> free clusters count validation doesn't matter here. If you want to check
>> free cluster count, you should check free_clusters==0 or not (after
>> validation).
>
> I borrowed it from "fat_count_free_clusters()". anyway fill fix it.

Yes. fat_count_free_clusters() needs to check free_clusters value,
because it updates free_clusters value. If it's uptodate, does nothing.

>>> +     if (start < FAT_START_ENT)
>>> +             start = FAT_START_ENT;
>>
>> Valid data cluster is 2 - max_cluster, but it should be mapped to 0 -
>> (max_cluster - FAT_START_ENT). Otherwise this interface's abstraction is
>> useless, right?
>
> user program don't know the filesystem internals. The same program is
> used for ext4 and fat. so it should be handled at filesystem.

Yes. It's what I'm saying. If user wants to trim 0-2 then user will
specify 0-2, but this trims only 2. It's not right.

>>> +     fatent_set_entry(&fatent, start);
>>> +
>>> +     while (count < sbi->max_cluster) {
>>> +             if (fatent.entry >= sbi->max_cluster)
>>> +                     fatent.entry = FAT_START_ENT;
>>
>> Why do we cyclic this?
> If the start is middle and len is the whole disk size, then check the
> all clusters.

Strange design. If user wants to trim between middle and end, user have
to know length from middle correctly? Ext4 really does it?

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

  reply	other threads:[~2011-03-28  6:21 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-18  2:04 Kyungmin Park
2011-03-27 15:39 ` OGAWA Hirofumi
2011-03-28  5:57   ` Kyungmin Park
2011-03-28  6:21     ` OGAWA Hirofumi [this message]
2011-03-28  6:56       ` Kyungmin Park
2011-03-28  7:33         ` 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=874o6n6a0e.fsf@devron.myhome.or.jp \
    --to=hirofumi@mail.parknet.co.jp \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®