Patchwork [v3,06/30] libext2fs: remove redundant code

login
register
mail settings
Submitter Zheng Liu
Date Dec. 6, 2013, 9:57 a.m.
Message ID <1386323897-2354-7-git-send-email-wenqing.lz@taobao.com>
Download mbox | patch
Permalink /patch/297670/
State Superseded
Headers show

Comments

Zheng Liu - Dec. 6, 2013, 9:57 a.m.
From: "Darrick J. Wong" <darrick.wong@oracle.com>

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 lib/ext2fs/ext_attr.c |   39 +++++++++++++++++----------------------
 1 file changed, 17 insertions(+), 22 deletions(-)

Patch

diff --git a/lib/ext2fs/ext_attr.c b/lib/ext2fs/ext_attr.c
index 81f60ca..1b65c4b 100644
--- a/lib/ext2fs/ext_attr.c
+++ b/lib/ext2fs/ext_attr.c
@@ -466,7 +466,7 @@  errcode_t ext2fs_xattrs_write(struct ext2_xattr_handle *handle)
 	__u32 ea_inode_magic;
 	blk64_t blk;
 	unsigned int storage_size;
-	unsigned int i, written;
+	unsigned int i;
 	errcode_t err;
 
 	if (!EXT2_HAS_COMPAT_FEATURE(handle->fs->super,
@@ -531,26 +531,24 @@  write_ea_block:
 		goto out2;
 	}
 
-	if (block_buf) {
-		/* Write a header on the EA block */
-		header = block_buf;
-		header->h_magic = EXT2_EXT_ATTR_MAGIC;
-		header->h_refcount = 1;
-		header->h_blocks = 1;
+	/* Write a header on the EA block */
+	header = block_buf;
+	header->h_magic = EXT2_EXT_ATTR_MAGIC;
+	header->h_refcount = 1;
+	header->h_blocks = 1;
 
-		/* Get a new block for writing */
-		err = prep_ea_block_for_write(handle->fs, handle->ino, inode);
-		if (err)
-			goto out2;
+	/* Get a new block for writing */
+	err = prep_ea_block_for_write(handle->fs, handle->ino, inode);
+	if (err)
+		goto out2;
 
-		/* Finally, write the new EA block */
-		blk = ext2fs_file_acl_block(handle->fs,
-					    (struct ext2_inode *)inode);
-		err = ext2fs_write_ext_attr3(handle->fs, blk, block_buf,
-					     handle->ino);
-		if (err)
-			goto out2;
-	}
+	/* Finally, write the new EA block */
+	blk = ext2fs_file_acl_block(handle->fs,
+				    (struct ext2_inode *)inode);
+	err = ext2fs_write_ext_attr3(handle->fs, blk, block_buf,
+				     handle->ino);
+	if (err)
+		goto out2;
 
 skip_ea_block:
 	blk = ext2fs_file_acl_block(handle->fs, (struct ext2_inode *)inode);
@@ -663,7 +661,6 @@  static errcode_t read_xattrs_from_buffer(struct ext2_xattr_handle *handle,
 errcode_t ext2fs_xattrs_read(struct ext2_xattr_handle *handle)
 {
 	struct ext2_xattr *attrs = NULL, *x;
-	unsigned int attrs_len;
 	struct ext2_inode_large *inode;
 	struct ext2_ext_attr_header *header;
 	__u32 ea_inode_magic;
@@ -765,8 +762,6 @@  out:
 	return err;
 }
 
-#define XATTR_ABORT	1
-#define XATTR_CHANGED	2
 errcode_t ext2fs_xattrs_iterate(struct ext2_xattr_handle *h,
 				int (*func)(char *name, char *value,
 					    size_t value_len, void *data),