diff options
author | Tao Ma <tao.ma@oracle.com> | 2010-08-16 16:58:21 +0800 |
---|---|---|
committer | Joel Becker <joel.becker@oracle.com> | 2010-09-10 08:56:24 -0700 |
commit | b4d693fcc5fe99ed211addb5c6a0f8398f0b266e (patch) | |
tree | d036160f644030afb1e91f275cd62aa79d9293b2 /fs/ocfs2/super.c | |
parent | a33f13efe05192e7a805018a2ce2b2afddd04057 (diff) | |
download | linux-3.10-b4d693fcc5fe99ed211addb5c6a0f8398f0b266e.tar.gz linux-3.10-b4d693fcc5fe99ed211addb5c6a0f8398f0b266e.tar.bz2 linux-3.10-b4d693fcc5fe99ed211addb5c6a0f8398f0b266e.zip |
ocfs2: Cache system inodes of other slots.
Durring orphan scan, if we are slot 0, and we are replaying
orphan_dir:0001, the general process is that for every file
in this dir:
1. we will iget orphan_dir:0001, since there is no inode for it.
we will have to create an inode and read it from the disk.
2. do the normal work, such as delete_inode and remove it from
the dir if it is allowed.
3. call iput orphan_dir:0001 when we are done. In this case,
since we have no dcache for this inode, i_count will
reach 0, and VFS will have to call clear_inode and in
ocfs2_clear_inode we will checkpoint the inode which will let
ocfs2_cmt and journald begin to work.
4. We loop back to 1 for the next file.
So you see, actually for every deleted file, we have to read the
orphan dir from the disk and checkpoint the journal. It is very
time consuming and cause a lot of journal checkpoint I/O.
A better solution is that we can have another reference for these
inodes in ocfs2_super. So if there is no other race among
nodes(which will let dlmglue to checkpoint the inode), for step 3,
clear_inode won't be called and for step 1, we may only need to
read the inode for the 1st time. This is a big win for us.
So this patch will try to cache system inodes of other slots so
that we will have one more reference for these inodes and avoid
the extra inode read and journal checkpoint.
Signed-off-by: Tao Ma <tao.ma@oracle.com>
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Diffstat (limited to 'fs/ocfs2/super.c')
-rw-r--r-- | fs/ocfs2/super.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c index 47415398d56..350e8b5a939 100644 --- a/fs/ocfs2/super.c +++ b/fs/ocfs2/super.c @@ -514,11 +514,11 @@ static void ocfs2_release_system_inodes(struct ocfs2_super *osb) mlog_entry_void(); - for (i = 0; i < NUM_SYSTEM_INODES; i++) { - inode = osb->system_inodes[i]; + for (i = 0; i < NUM_GLOBAL_SYSTEM_INODES; i++) { + inode = osb->global_system_inodes[i]; if (inode) { iput(inode); - osb->system_inodes[i] = NULL; + osb->global_system_inodes[i] = NULL; } } @@ -534,6 +534,20 @@ static void ocfs2_release_system_inodes(struct ocfs2_super *osb) osb->root_inode = NULL; } + if (!osb->local_system_inodes) + goto out; + + for (i = 0; i < NUM_LOCAL_SYSTEM_INODES * osb->max_slots; i++) { + if (osb->local_system_inodes[i]) { + iput(osb->local_system_inodes[i]); + osb->local_system_inodes[i] = NULL; + } + } + + kfree(osb->local_system_inodes); + osb->local_system_inodes = NULL; + +out: mlog_exit(0); } |