diff options
author | Joseph Qi <joseph.qi@huawei.com> | 2015-11-05 21:44:01 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-11-05 22:34:48 -0500 |
commit | 30edc43c7ff0760f6896c37c06a84533546588fa (patch) | |
tree | 8efec5a760541f77cba67c9eba9b783e36313d44 | |
parent | 1d1aff8cf367d2216a678c722161784e207965c4 (diff) |
ocfs2: do not include dio entry in case of orphan scan
dio entry will only do truncate in case of ORPHAN_NEED_TRUNCATE. So do
not include it when doing normal orphan scan to reduce contention.
Signed-off-by: Joseph Qi <joseph.qi@huawei.com>
Cc: Mark Fasheh <mfasheh@suse.de>
Cc: Joel Becker <jlbec@evilplan.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | fs/ocfs2/journal.c | 15 | ||||
-rw-r--r-- | fs/ocfs2/namei.c | 2 | ||||
-rw-r--r-- | fs/ocfs2/namei.h | 3 |
3 files changed, 15 insertions, 5 deletions
diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c index ff82b28462a6..4bac6007837d 100644 --- a/fs/ocfs2/journal.c +++ b/fs/ocfs2/journal.c | |||
@@ -2021,6 +2021,7 @@ struct ocfs2_orphan_filldir_priv { | |||
2021 | struct dir_context ctx; | 2021 | struct dir_context ctx; |
2022 | struct inode *head; | 2022 | struct inode *head; |
2023 | struct ocfs2_super *osb; | 2023 | struct ocfs2_super *osb; |
2024 | enum ocfs2_orphan_reco_type orphan_reco_type; | ||
2024 | }; | 2025 | }; |
2025 | 2026 | ||
2026 | static int ocfs2_orphan_filldir(struct dir_context *ctx, const char *name, | 2027 | static int ocfs2_orphan_filldir(struct dir_context *ctx, const char *name, |
@@ -2036,6 +2037,12 @@ static int ocfs2_orphan_filldir(struct dir_context *ctx, const char *name, | |||
2036 | if (name_len == 2 && !strncmp("..", name, 2)) | 2037 | if (name_len == 2 && !strncmp("..", name, 2)) |
2037 | return 0; | 2038 | return 0; |
2038 | 2039 | ||
2040 | /* do not include dio entry in case of orphan scan */ | ||
2041 | if ((p->orphan_reco_type == ORPHAN_NO_NEED_TRUNCATE) && | ||
2042 | (!strncmp(name, OCFS2_DIO_ORPHAN_PREFIX, | ||
2043 | OCFS2_DIO_ORPHAN_PREFIX_LEN))) | ||
2044 | return 0; | ||
2045 | |||
2039 | /* Skip bad inodes so that recovery can continue */ | 2046 | /* Skip bad inodes so that recovery can continue */ |
2040 | iter = ocfs2_iget(p->osb, ino, | 2047 | iter = ocfs2_iget(p->osb, ino, |
2041 | OCFS2_FI_FLAG_ORPHAN_RECOVERY, 0); | 2048 | OCFS2_FI_FLAG_ORPHAN_RECOVERY, 0); |
@@ -2060,14 +2067,16 @@ static int ocfs2_orphan_filldir(struct dir_context *ctx, const char *name, | |||
2060 | 2067 | ||
2061 | static int ocfs2_queue_orphans(struct ocfs2_super *osb, | 2068 | static int ocfs2_queue_orphans(struct ocfs2_super *osb, |
2062 | int slot, | 2069 | int slot, |
2063 | struct inode **head) | 2070 | struct inode **head, |
2071 | enum ocfs2_orphan_reco_type orphan_reco_type) | ||
2064 | { | 2072 | { |
2065 | int status; | 2073 | int status; |
2066 | struct inode *orphan_dir_inode = NULL; | 2074 | struct inode *orphan_dir_inode = NULL; |
2067 | struct ocfs2_orphan_filldir_priv priv = { | 2075 | struct ocfs2_orphan_filldir_priv priv = { |
2068 | .ctx.actor = ocfs2_orphan_filldir, | 2076 | .ctx.actor = ocfs2_orphan_filldir, |
2069 | .osb = osb, | 2077 | .osb = osb, |
2070 | .head = *head | 2078 | .head = *head, |
2079 | .orphan_reco_type = orphan_reco_type | ||
2071 | }; | 2080 | }; |
2072 | 2081 | ||
2073 | orphan_dir_inode = ocfs2_get_system_file_inode(osb, | 2082 | orphan_dir_inode = ocfs2_get_system_file_inode(osb, |
@@ -2170,7 +2179,7 @@ static int ocfs2_recover_orphans(struct ocfs2_super *osb, | |||
2170 | trace_ocfs2_recover_orphans(slot); | 2179 | trace_ocfs2_recover_orphans(slot); |
2171 | 2180 | ||
2172 | ocfs2_mark_recovering_orphan_dir(osb, slot); | 2181 | ocfs2_mark_recovering_orphan_dir(osb, slot); |
2173 | ret = ocfs2_queue_orphans(osb, slot, &inode); | 2182 | ret = ocfs2_queue_orphans(osb, slot, &inode, orphan_reco_type); |
2174 | ocfs2_clear_recovering_orphan_dir(osb, slot); | 2183 | ocfs2_clear_recovering_orphan_dir(osb, slot); |
2175 | 2184 | ||
2176 | /* Error here should be noted, but we want to continue with as | 2185 | /* Error here should be noted, but we want to continue with as |
diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c index b7dfac226b1e..1206392a071f 100644 --- a/fs/ocfs2/namei.c +++ b/fs/ocfs2/namei.c | |||
@@ -106,8 +106,6 @@ static int ocfs2_double_lock(struct ocfs2_super *osb, | |||
106 | static void ocfs2_double_unlock(struct inode *inode1, struct inode *inode2); | 106 | static void ocfs2_double_unlock(struct inode *inode1, struct inode *inode2); |
107 | /* An orphan dir name is an 8 byte value, printed as a hex string */ | 107 | /* An orphan dir name is an 8 byte value, printed as a hex string */ |
108 | #define OCFS2_ORPHAN_NAMELEN ((int)(2 * sizeof(u64))) | 108 | #define OCFS2_ORPHAN_NAMELEN ((int)(2 * sizeof(u64))) |
109 | #define OCFS2_DIO_ORPHAN_PREFIX "dio-" | ||
110 | #define OCFS2_DIO_ORPHAN_PREFIX_LEN 4 | ||
111 | 109 | ||
112 | static struct dentry *ocfs2_lookup(struct inode *dir, struct dentry *dentry, | 110 | static struct dentry *ocfs2_lookup(struct inode *dir, struct dentry *dentry, |
113 | unsigned int flags) | 111 | unsigned int flags) |
diff --git a/fs/ocfs2/namei.h b/fs/ocfs2/namei.h index e173329eb830..1155918d6784 100644 --- a/fs/ocfs2/namei.h +++ b/fs/ocfs2/namei.h | |||
@@ -26,6 +26,9 @@ | |||
26 | #ifndef OCFS2_NAMEI_H | 26 | #ifndef OCFS2_NAMEI_H |
27 | #define OCFS2_NAMEI_H | 27 | #define OCFS2_NAMEI_H |
28 | 28 | ||
29 | #define OCFS2_DIO_ORPHAN_PREFIX "dio-" | ||
30 | #define OCFS2_DIO_ORPHAN_PREFIX_LEN 4 | ||
31 | |||
29 | extern const struct inode_operations ocfs2_dir_iops; | 32 | extern const struct inode_operations ocfs2_dir_iops; |
30 | 33 | ||
31 | struct dentry *ocfs2_get_parent(struct dentry *child); | 34 | struct dentry *ocfs2_get_parent(struct dentry *child); |