From 71b86f562b5eb6f94ea00bba060caa64d0137969 Mon Sep 17 00:00:00 2001 From: Steven Whitehouse Date: Tue, 28 Mar 2006 14:14:04 -0500 Subject: [GFS2] Further updates to dir and logging code This reduces the size of the directory code by about 3k and gets readdir() to use the functions which were introduced in the previous directory code update. Two memory allocations are merged into one. Eliminates zeroing of some buffers which were never used before they were initialised by other data. There is still scope for further improvement in the directory code. On the logging side, a hand created mutex has been replaced by a standard Linux mutex in the log allocation code. Signed-off-by: Steven Whitehouse --- fs/gfs2/ops_inode.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'fs/gfs2/ops_inode.c') diff --git a/fs/gfs2/ops_inode.c b/fs/gfs2/ops_inode.c index e8ab9d254b76..1e2b709711ae 100644 --- a/fs/gfs2/ops_inode.c +++ b/fs/gfs2/ops_inode.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include @@ -417,18 +418,16 @@ static int gfs2_mkdir(struct inode *dir, struct dentry *dentry, int mode) if (!gfs2_assert_withdraw(sdp, !error)) { struct gfs2_dinode *di = (struct gfs2_dinode *)dibh->b_data; struct gfs2_dirent *dent = (struct gfs2_dirent *)(di+1); - struct qstr str = { .name = ".", .len = 1 }; - str.hash = gfs2_disk_hash(str.name, str.len); + struct qstr str; + gfs2_str2qstr(&str, "."); gfs2_trans_add_bh(ip->i_gl, dibh, 1); gfs2_qstr2dirent(&str, GFS2_DIRENT_SIZE(str.len), dent); dent->de_inum = di->di_num; /* already GFS2 endian */ dent->de_type = DT_DIR; di->di_entries = cpu_to_be32(1); - str.name = ".."; - str.len = 2; - str.hash = gfs2_disk_hash(str.name, str.len); + gfs2_str2qstr(&str, ".."); dent = (struct gfs2_dirent *)((char*)dent + GFS2_DIRENT_SIZE(1)); gfs2_qstr2dirent(&str, dibh->b_size - GFS2_DIRENT_SIZE(1) - sizeof(struct gfs2_dinode), dent); @@ -772,9 +771,7 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry, if (dir_rename) { struct qstr name; - name.len = 2; - name.name = ".."; - name.hash = gfs2_disk_hash(name.name, name.len); + gfs2_str2qstr(&name, ".."); error = gfs2_change_nlink(ndip, +1); if (error) -- cgit v1.2.3