diff options
author | Steven Whitehouse <swhiteho@redhat.com> | 2006-03-28 14:14:04 -0500 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2006-03-28 14:14:04 -0500 |
commit | 71b86f562b5eb6f94ea00bba060caa64d0137969 (patch) | |
tree | 63d982e09a9cb934fe656afe115031c0a9dc5e4a /fs/gfs2/ops_inode.c | |
parent | 94aabbd99370f738da4f6cb4ea0b94cd9024002f (diff) |
[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 <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2/ops_inode.c')
-rw-r--r-- | fs/gfs2/ops_inode.c | 13 |
1 files changed, 5 insertions, 8 deletions
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 @@ | |||
18 | #include <linux/xattr.h> | 18 | #include <linux/xattr.h> |
19 | #include <linux/posix_acl.h> | 19 | #include <linux/posix_acl.h> |
20 | #include <linux/gfs2_ondisk.h> | 20 | #include <linux/gfs2_ondisk.h> |
21 | #include <linux/crc32.h> | ||
21 | #include <asm/semaphore.h> | 22 | #include <asm/semaphore.h> |
22 | #include <asm/uaccess.h> | 23 | #include <asm/uaccess.h> |
23 | 24 | ||
@@ -417,18 +418,16 @@ static int gfs2_mkdir(struct inode *dir, struct dentry *dentry, int mode) | |||
417 | if (!gfs2_assert_withdraw(sdp, !error)) { | 418 | if (!gfs2_assert_withdraw(sdp, !error)) { |
418 | struct gfs2_dinode *di = (struct gfs2_dinode *)dibh->b_data; | 419 | struct gfs2_dinode *di = (struct gfs2_dinode *)dibh->b_data; |
419 | struct gfs2_dirent *dent = (struct gfs2_dirent *)(di+1); | 420 | struct gfs2_dirent *dent = (struct gfs2_dirent *)(di+1); |
420 | struct qstr str = { .name = ".", .len = 1 }; | 421 | struct qstr str; |
421 | str.hash = gfs2_disk_hash(str.name, str.len); | ||
422 | 422 | ||
423 | gfs2_str2qstr(&str, "."); | ||
423 | gfs2_trans_add_bh(ip->i_gl, dibh, 1); | 424 | gfs2_trans_add_bh(ip->i_gl, dibh, 1); |
424 | gfs2_qstr2dirent(&str, GFS2_DIRENT_SIZE(str.len), dent); | 425 | gfs2_qstr2dirent(&str, GFS2_DIRENT_SIZE(str.len), dent); |
425 | dent->de_inum = di->di_num; /* already GFS2 endian */ | 426 | dent->de_inum = di->di_num; /* already GFS2 endian */ |
426 | dent->de_type = DT_DIR; | 427 | dent->de_type = DT_DIR; |
427 | di->di_entries = cpu_to_be32(1); | 428 | di->di_entries = cpu_to_be32(1); |
428 | 429 | ||
429 | str.name = ".."; | 430 | gfs2_str2qstr(&str, ".."); |
430 | str.len = 2; | ||
431 | str.hash = gfs2_disk_hash(str.name, str.len); | ||
432 | dent = (struct gfs2_dirent *)((char*)dent + GFS2_DIRENT_SIZE(1)); | 431 | dent = (struct gfs2_dirent *)((char*)dent + GFS2_DIRENT_SIZE(1)); |
433 | gfs2_qstr2dirent(&str, dibh->b_size - GFS2_DIRENT_SIZE(1) - sizeof(struct gfs2_dinode), dent); | 432 | gfs2_qstr2dirent(&str, dibh->b_size - GFS2_DIRENT_SIZE(1) - sizeof(struct gfs2_dinode), dent); |
434 | 433 | ||
@@ -772,9 +771,7 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry, | |||
772 | 771 | ||
773 | if (dir_rename) { | 772 | if (dir_rename) { |
774 | struct qstr name; | 773 | struct qstr name; |
775 | name.len = 2; | 774 | gfs2_str2qstr(&name, ".."); |
776 | name.name = ".."; | ||
777 | name.hash = gfs2_disk_hash(name.name, name.len); | ||
778 | 775 | ||
779 | error = gfs2_change_nlink(ndip, +1); | 776 | error = gfs2_change_nlink(ndip, +1); |
780 | if (error) | 777 | if (error) |