From: Tao Ma <tm@tao.ma>
To: Lukas Czerner <lczerner@redhat.com>
Cc: linux-ext4@vger.kernel.org, tytso@mit.edu
Subject: Re: [PATCH] mke2fs: Inform user of ongoing discard
Date: Mon, 13 Dec 2010 23:40:12 +0800 [thread overview]
Message-ID: <4D063E5C.2050301@tao.ma> (raw)
In-Reply-To: <1292233546-12017-1-git-send-email-lczerner@redhat.com>
Hi Lukas,
On 12/13/2010 05:45 PM, Lukas Czerner wrote:
<snip>
> @@ -1922,6 +1925,44 @@ static int mke2fs_setup_tdb(const char *name, io_manager *io_ptr)
> return retval;
> }
>
> +static int mke2fs_discard_device(ext2_filsys fs)
> +{
> + struct ext2fs_numeric_progress_struct progress;
> + blk64_t blocks = ext2fs_blocks_count(fs->super);
> + blk64_t count = DISCARD_STEP_MB;
> + blk64_t cur = 0;
> + int retval = 0;
> +
> + count *= MB;
> + count /= fs->blocksize;
> +
> + ext2fs_numeric_progress_init(fs,&progress,
> + _("Discarding device blocks: "),
> + blocks);
> + while (cur< blocks) {
> + ext2fs_numeric_progress_update(fs,&progress, cur);
> +
> + retval = io_channel_discard(fs->io, cur, count, fs->blocksize);
Here we need to limit 'count' within ext4's block range for the 1st
round, otherwise it will discard the blocks outside our ext4 volume in
case the size is less than 2GB.
Regards,
Tao
next prev parent reply other threads:[~2010-12-13 15:40 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-13 9:45 [PATCH] mke2fs: Inform user of ongoing discard Lukas Czerner
2010-12-13 15:40 ` Tao Ma [this message]
2010-12-13 16:56 ` Lukas Czerner
2010-12-13 17:08 ` Lukas Czerner
2011-01-03 11:06 ` 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=4D063E5C.2050301@tao.ma \
--to=tm@tao.ma \
--cc=lczerner@redhat.com \
--cc=linux-ext4@vger.kernel.org \
--cc=tytso@mit.edu \
/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).