[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4D063E5C.2050301@tao.ma>
Date: Mon, 13 Dec 2010 23:40:12 +0800
From: Tao Ma <tm@....ma>
To: Lukas Czerner <lczerner@...hat.com>
CC: linux-ext4@...r.kernel.org, tytso@....edu
Subject: Re: [PATCH] mke2fs: Inform user of ongoing discard
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
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists