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@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html