From: Kyungmin Park <kmpark@infradead.org>
To: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
Lukas Czerner <lczerner@redhat.com>
Subject: Re: [PATCH v6] fat: Batched discard support for fat
Date: Tue, 29 Mar 2011 14:11:35 +0900 [thread overview]
Message-ID: <AANLkTinGPxxTaCzDUfgK7QX6C-AWim5ZJUub1BgCw4YC@mail.gmail.com> (raw)
In-Reply-To: <87k4fi4iwq.fsf@devron.myhome.or.jp>
On Tue, Mar 29, 2011 at 2:04 PM, OGAWA Hirofumi
<hirofumi@mail.parknet.co.jp> wrote:
> Kyungmin Park <kmpark@infradead.org> writes:
>
>> +int fat_trim_fs(struct super_block *sb, struct fstrim_range *range)
>> +{
>> + struct msdos_sb_info *sbi = MSDOS_SB(sb);
>> + struct fatent_operations *ops = sbi->fatent_ops;
>> + struct fat_entry fatent;
>> + unsigned long reada_blocks, reada_mask, cur_block;
>> + int err, free, count, entry;
>> + int start, len, minlen, trimmed;
>> +
>> + start = range->start >> sb->s_blocksize_bits;
>> + len = range->len >> sb->s_blocksize_bits;
>> + len = round_down(start + len, sbi->sec_per_clus);
>> + start = round_up(start, sbi->sec_per_clus);
>> + minlen = range->minlen >> sb->s_blocksize_bits;
>> + minlen = round_up(minlen, sbi->sec_per_clus);
>> + trimmed = 0;
>> + count = 0;
>> + err = -EINVAL;
>
> Sorry for didn't mention at previous. You can use ->cluster_size, and
> ->cluster_bits.
>
>> + if (start >= sbi->max_cluster)
>> + goto out;
>> +
>> + len = (len > sbi->max_cluster) ? sbi->max_cluster : len;
>
> [...]
>
>> + trimmed += free;
>> + }
>> + range->len = (u64)(trimmed * sbi->sec_per_clus) << sb->s_blocksize_bits;
>> + fatent_brelse(&fatent);
>> +out:
>> + unlock_fat(sbi);
>> + return err;
>
> Again, this ioctl's design is unclear, and seems to be strange. I
> wouldn't want to add this before clearing it. Please explain what is
> right behavior.
Umm it's out of my scope. it's trim design.
See also btrfs batched discard support. it's also no consideration as
you mentioned.
As I know, now xfs, ext4, and btrfs support this fstrim without these concern.
http://thread.gmane.org/gmane.comp.file-systems.btrfs/9758
Thank you,
Kyungmin Park
>
> E.g. if user specified 0-1024 and FS data block was actually started at
> 2048. What is right behavior? And if the end of blocks, what returned?
> For now, it seems to return range->len == 0 on both cases.
>
> Well, so, my suggestion is providing this like flat one extent
> file. I.e. FS have to map actual block placement to flat. And result
> also like write/read (return bytes as trimed, and at EOF returns 0).
>
> 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
>
--
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
next prev parent reply other threads:[~2011-03-29 5:11 UTC|newest]
Thread overview: 33+ 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 [this message]
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
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=AANLkTinGPxxTaCzDUfgK7QX6C-AWim5ZJUub1BgCw4YC@mail.gmail.com \
--to=kmpark@infradead.org \
--cc=hirofumi@mail.parknet.co.jp \
--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;
as well as URLs for NNTP newsgroup(s).