aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaulo Alcantara <pcacjr@zytor.com>2013-01-22 01:54:09 -0200
committerPaulo Alcantara <pcacjr@zytor.com>2013-01-22 01:54:09 -0200
commit2be24375ed6af881405d23483aebe81ce3dcb3b7 (patch)
tree8653a63431eaad948ddfa0551ea0959caede2137
parentee50a6f37b19e7682a77a740392bcafb70250bad (diff)
downloadsyslinux-2be24375ed6af881405d23483aebe81ce3dcb3b7.tar.gz
xfs: Remove unnecessary free()'s
Those freed memories are all now cached and need to get flushed at some point. Signed-off-by: Paulo Alcantara <pcacjr@zytor.com>
-rw-r--r--core/fs/xfs/xfs.c9
-rw-r--r--core/fs/xfs/xfs_dir2.c11
-rw-r--r--core/fs/xfs/xfs_readdir.c20
3 files changed, 3 insertions, 37 deletions
diff --git a/core/fs/xfs/xfs.c b/core/fs/xfs/xfs.c
index 4d60c08b..b6a396aa 100644
--- a/core/fs/xfs/xfs.c
+++ b/core/fs/xfs/xfs.c
@@ -58,8 +58,6 @@ static inline int xfs_fmt_extents_readdir(struct file *file,
/* Node Directory */
return xfs_readdir_dir2_node(file, dirent, core);
}
-
- return -1;
}
static int xfs_readdir(struct file *file, struct dirent *dirent)
@@ -202,8 +200,6 @@ static inline struct inode *xfs_fmt_extents_find_entry(const char *dname,
/* Node Directory */
return xfs_dir2_node_find_entry(dname, parent, core);
}
-
- return NULL;
}
static inline struct inode *xfs_fmt_btree_find_entry(const char *dname,
@@ -233,11 +229,6 @@ static struct inode *xfs_iget(const char *dname, struct inode *parent)
inode = xfs_fmt_extents_find_entry(dname, parent, core);
} else if (core->di_format == XFS_DINODE_FMT_BTREE) {
inode = xfs_fmt_btree_find_entry(dname, parent, core);
- } else {
- xfs_debug("format %hhu", core->di_format);
- xfs_debug("TODO: format \"local\" and \"extents\" are the only "
- "supported ATM");
- goto out;
}
if (!inode) {
diff --git a/core/fs/xfs/xfs_dir2.c b/core/fs/xfs/xfs_dir2.c
index 81b8c241..39a586b5 100644
--- a/core/fs/xfs/xfs_dir2.c
+++ b/core/fs/xfs/xfs_dir2.c
@@ -433,8 +433,6 @@ struct inode *xfs_dir2_leaf_find_entry(const char *dname, struct inode *parent,
}
out:
- free(leaf);
-
return NULL;
found:
@@ -471,13 +469,10 @@ found:
xfs_debug("entry inode's number %lu", ino);
- free(leaf);
-
return ip;
failed:
free(ip);
- free(leaf);
return ip;
}
@@ -673,7 +668,6 @@ struct inode *xfs_dir2_node_find_entry(const char *dname, struct inode *parent,
goto out;
}
- free(node);
node = (xfs_da_intnode_t *)xfs_dir2_dirblks_get_cached(parent->fs,
fsblkno, 1);
} while(be16_to_cpu(node->hdr.info.magic) == XFS_DA_NODE_MAGIC);
@@ -747,8 +741,6 @@ struct inode *xfs_dir2_node_find_entry(const char *dname, struct inode *parent,
}
out:
- free(node);
-
return NULL;
found:
@@ -780,13 +772,10 @@ found:
xfs_debug("entry inode's number %lu", ino);
- free(node);
-
return ip;
failed:
free(ip);
- free(node);
return NULL;
}
diff --git a/core/fs/xfs/xfs_readdir.c b/core/fs/xfs/xfs_readdir.c
index e99ea710..952f33b3 100644
--- a/core/fs/xfs/xfs_readdir.c
+++ b/core/fs/xfs/xfs_readdir.c
@@ -255,13 +255,9 @@ int xfs_readdir_dir2_leaf(struct file *file, struct dirent *dirent,
if (retval)
xfs_error("Failed to fill in dirent structure");
- free(leaf);
-
return retval;
out:
- free(leaf);
-
return -1;
}
@@ -316,14 +312,13 @@ try_next_btree:
leaf = (xfs_dir2_leaf_t*)xfs_dir2_dirblks_get_cached(fs, fsblkno, 1);
if (be16_to_cpu(leaf->hdr.info.magic) != XFS_DIR2_LEAFN_MAGIC) {
xfs_error("Leaf's magic number does not match!");
- goto out1;
+ goto out;
}
if (!leaf->hdr.count ||
XFS_PVT(inode)->i_leaf_ent_offset >= be16_to_cpu(leaf->hdr.count)) {
XFS_PVT(inode)->i_btree_offset++;
XFS_PVT(inode)->i_leaf_ent_offset = 0;
- free(leaf);
goto try_next_btree;
}
@@ -337,7 +332,6 @@ try_next_btree:
if (XFS_PVT(inode)->i_leaf_ent_offset == be16_to_cpu(leaf->hdr.count)) {
XFS_PVT(inode)->i_btree_offset++;
XFS_PVT(inode)->i_leaf_ent_offset = 0;
- free(leaf);
goto try_next_btree;
} else {
XFS_PVT(inode)->i_leaf_ent_offset++;
@@ -348,14 +342,14 @@ try_next_btree:
fsblkno = xfs_dir2_get_right_blk(fs, core, db, &error);
if (error) {
xfs_error("Cannot find data block!");
- goto out1;
+ goto out;
}
buf = xfs_dir2_dirblks_get_cached(fs, fsblkno, 1);
data_hdr = (xfs_dir2_data_hdr_t *)buf;
if (be32_to_cpu(data_hdr->magic) != XFS_DIR2_DATA_MAGIC) {
xfs_error("Leaf directory's data magic No. does not match!");
- goto out1;
+ goto out;
}
offset = xfs_dir2_dataptr_to_off(fs, be32_to_cpu(lep->address));
@@ -370,17 +364,9 @@ try_next_btree:
if (retval)
xfs_error("Failed to fill in dirent structure");
- free(leaf);
- free(node);
-
return retval;
-out1:
- free(leaf);
-
out:
- free(node);
-
XFS_PVT(inode)->i_btree_offset = 0;
XFS_PVT(inode)->i_leaf_ent_offset = 0;