From: Ted Ts'o <tytso@mit.edu>
To: Lukas Czerner <lczerner@redhat.com>
Cc: linux-ext4@vger.kernel.org, rwheeler@redhat.com,
sandeen@redhat.com, adilger@dilger.ca,
Dmitry Monakhov <dmonakhov@openvz.org>
Subject: Re: [PATCH 3/4] ext4: Add batched discard support for ext4
Date: Mon, 25 Oct 2010 14:50:10 -0400 [thread overview]
Message-ID: <20101025185010.GH16981@thunk.org> (raw)
In-Reply-To: <1285596600-28358-4-git-send-email-lczerner@redhat.com>
On Mon, Sep 27, 2010 at 04:09:59PM +0200, Lukas Czerner wrote:
> diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
> index 93eb6c2..80a5139 100644
> --- a/fs/ext4/mballoc.c
> +++ b/fs/ext4/mballoc.c
....
> + struct ext4_buddy e4b;
> + ext4_fsblk_t first_group, last_group;
This should be ext4_group_t, shouldn't it?
> + /* Determine first and last group to examine based on start and len */
> + first_group = (start - le32_to_cpu(es->s_first_data_block)) /
> + EXT4_BLOCKS_PER_GROUP(sb);
> + last_group = (start + len - le32_to_cpu(es->s_first_data_block)) /
> + EXT4_BLOCKS_PER_GROUP(sb);
I've tried compiling this for 32-bit x86, and this blows up because
you can't divide long long's in the kernel. (This is what do_div is
for, and it's why ext4_get_group_no_and_offset() exists.)
> + first_block = (start - le32_to_cpu(es->s_first_data_block)) %
> + EXT4_BLOCKS_PER_GROUP(sb);
> + last_block = EXT4_BLOCKS_PER_GROUP(sb);
This means that the ext4 FITRIM ioctl will trim to the end of the
blockgroup, and not just to the last block specified by the user. Is
this intentional?
Also, it looks like there's nothing to check for the last blockgroup,
where the last block might be less than a grpblk_t offset of
EXT4_BLOCKS_PER_GROUP()?
- Ted
next prev parent reply other threads:[~2010-10-25 18:50 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-27 14:09 [PATCH 0/4 v. 9] Ext3/Ext4 Batched discard support Lukas Czerner
2010-09-27 14:09 ` [PATCH 1/4] ext4: Use return value from sb_issue_discard() Lukas Czerner
2010-09-27 14:09 ` [PATCH 2/4] Add ioctl FITRIM Lukas Czerner
2010-09-27 14:09 ` [PATCH 3/4] ext4: Add batched discard support for ext4 Lukas Czerner
2010-10-25 18:50 ` Ted Ts'o [this message]
2010-10-25 19:08 ` Ted Ts'o
2010-10-26 12:43 ` Lukas Czerner
2010-10-26 14:20 ` Ted Ts'o
2010-10-26 14:36 ` Lukas Czerner
2010-09-27 14:10 ` [PATCH 4/4] ext3: Add batched discard support for ext3 Lukas Czerner
2010-09-27 14:11 ` [PATCH 0/4 v. 9] Ext3/Ext4 Batched discard support - fstrim Lukas Czerner
2010-10-11 17:02 ` [PATCH 0/4 v. 9] Ext3/Ext4 Batched discard support Lukas Czerner
2010-10-25 14:57 ` Ted Ts'o
2010-10-25 16:06 ` Fstrim tool Lukas Czerner
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=20101025185010.GH16981@thunk.org \
--to=tytso@mit.edu \
--cc=adilger@dilger.ca \
--cc=dmonakhov@openvz.org \
--cc=lczerner@redhat.com \
--cc=linux-ext4@vger.kernel.org \
--cc=rwheeler@redhat.com \
--cc=sandeen@redhat.com \
/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).