Re: [PATCH 09/47] libext2fs: use a dynamically sized (or caller-provided) block zeroing buffer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Dec 13, 2014 at 11:24:03AM -0500, Theodore Ts'o wrote:
> This is my replacement patch.

Followed by...

commit bc57b123d61f49cddcc3fb594fda2dcf589f9b38
Author: Theodore Ts'o <tytso@xxxxxxx>
Date:   Fri Dec 12 22:12:45 2014 -0500

    libext2fs: use block_buf in ext2fs_alloc_block2() if it is provided
    
    If the caller supplies a buffer to ext2fs_alloc_block2(), use it
    instead of calling ext2fs_zero_blocks2().
    
    Signed-off-by: Theodore Ts'o <tytso@xxxxxxx>

diff --git a/lib/ext2fs/alloc.c b/lib/ext2fs/alloc.c
index 54535c4..1bb4d47 100644
--- a/lib/ext2fs/alloc.c
+++ b/lib/ext2fs/alloc.c
@@ -184,9 +184,6 @@ errcode_t ext2fs_alloc_block2(ext2_filsys fs, blk64_t goal,
 	errcode_t	retval;
 	blk64_t		block;
 
-	if (block_buf)
-		memset(block_buf, 0, fs->blocksize);
-
 	if (fs->get_alloc_block) {
 		retval = (fs->get_alloc_block)(fs, goal, &block);
 		if (retval)
@@ -203,7 +200,11 @@ errcode_t ext2fs_alloc_block2(ext2_filsys fs, blk64_t goal,
 			goto fail;
 	}
 
-	retval = ext2fs_zero_blocks2(fs, block, 1, NULL, NULL);
+	if (block_buf) {
+		memset(block_buf, 0, fs->blocksize);
+		retval = io_channel_write_blk64(fs->io, block, 1, block_buf);
+	} else
+		retval = ext2fs_zero_blocks2(fs, block, 1, NULL, NULL);
 	if (retval)
 		goto fail;
 
--
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




[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux