From 3ff6b0960716ebb0ff1139633e3831e2602fa15a Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Mon, 26 May 2014 11:57:05 -0400 Subject: [PATCH] Update jan's s_orphan scalability patches to v3 --- reduce-contention-on-s_orphan_lock | 29 +++++++++++++---------------- use-sbi-in-ext4_orphan_add_del | 24 ++++++++---------------- 2 files changed, 21 insertions(+), 32 deletions(-) diff --git a/reduce-contention-on-s_orphan_lock b/reduce-contention-on-s_orphan_lock index 7f8d186a..dcf7b809 100644 --- a/reduce-contention-on-s_orphan_lock +++ b/reduce-contention-on-s_orphan_lock @@ -1,4 +1,4 @@ -ext4: Reduce contention on s_orphan_lock +ext4: reduce contention on s_orphan_lock From: Jan Kara @@ -9,14 +9,14 @@ shorter time in other cases. Signed-off-by: Jan Kara Signed-off-by: "Theodore Ts'o" --- - fs/ext4/namei.c | 109 +++++++++++++++++++++++++++++++++----------------------- + fs/ext4/namei.c | 109 +++++++++++++++++++++++++++++++++++------------------------ 1 file changed, 65 insertions(+), 44 deletions(-) diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c -index 5fcaa85b6dc5..0486fbafb808 100644 +index eb61584..3520ab8 100644 --- a/fs/ext4/namei.c +++ b/fs/ext4/namei.c -@@ -2539,13 +2539,17 @@ static int empty_dir(struct inode *inode) +@@ -2540,13 +2540,17 @@ static int empty_dir(struct inode *inode) return 1; } @@ -35,7 +35,7 @@ index 5fcaa85b6dc5..0486fbafb808 100644 */ int ext4_orphan_add(handle_t *handle, struct inode *inode) { -@@ -2553,13 +2557,19 @@ int ext4_orphan_add(handle_t *handle, struct inode *inode) +@@ -2554,13 +2558,19 @@ int ext4_orphan_add(handle_t *handle, struct inode *inode) struct ext4_sb_info *sbi = EXT4_SB(sb); struct ext4_iloc iloc; int err = 0, rc; @@ -57,7 +57,7 @@ index 5fcaa85b6dc5..0486fbafb808 100644 /* * Orphan handling is only valid for files with data blocks -@@ -2573,44 +2583,47 @@ int ext4_orphan_add(handle_t *handle, struct inode *inode) +@@ -2574,44 +2584,47 @@ int ext4_orphan_add(handle_t *handle, struct inode *inode) BUFFER_TRACE(sbi->s_sbh, "get_write_access"); err = ext4_journal_get_write_access(handle, sbi->s_sbh); if (err) @@ -115,7 +115,7 @@ index 5fcaa85b6dc5..0486fbafb808 100644 + if (err) { + /* + * We have to remove inode from in-memory list if -+ * addition to on disk orphan list failed. Stray orphan ++ * addition to on disk orphan list failed. Stray orphan + * list entries can cause panics at unmount time. + */ + mutex_lock(&sbi->s_orphan_lock); @@ -132,7 +132,7 @@ index 5fcaa85b6dc5..0486fbafb808 100644 ext4_std_error(sb, err); return err; } -@@ -2631,13 +2644,18 @@ int ext4_orphan_del(handle_t *handle, struct inode *inode) +@@ -2632,35 +2645,43 @@ int ext4_orphan_del(handle_t *handle, struct inode *inode) if (!sbi->s_journal && !(sbi->s_mount_state & EXT4_ORPHAN_FS)) return 0; @@ -154,8 +154,10 @@ index 5fcaa85b6dc5..0486fbafb808 100644 + mutex_lock(&sbi->s_orphan_lock); jbd_debug(4, "remove inode %lu from orphan list\n", inode->i_ino); ++ prev = ei->i_orphan.prev; list_del_init(&ei->i_orphan); -@@ -2646,20 +2664,23 @@ int ext4_orphan_del(handle_t *handle, struct inode *inode) + + /* If we're on an error path, we may not have a valid * transaction handle with which to update the orphan list on * disk, but we still need to remove the inode from the linked * list in memory. */ @@ -170,7 +172,6 @@ index 5fcaa85b6dc5..0486fbafb808 100644 + } + ino_next = NEXT_ORPHAN(inode); -+ prev = ei->i_orphan.prev; if (prev == &sbi->s_orphan) { jbd_debug(4, "superblock will point to %u\n", ino_next); BUFFER_TRACE(sbi->s_sbh, "get_write_access"); @@ -185,7 +186,7 @@ index 5fcaa85b6dc5..0486fbafb808 100644 err = ext4_handle_dirty_super(handle, inode->i_sb); } else { struct ext4_iloc iloc2; -@@ -2669,20 +2690,20 @@ int ext4_orphan_del(handle_t *handle, struct inode *inode) +@@ -2670,20 +2691,20 @@ int ext4_orphan_del(handle_t *handle, struct inode *inode) jbd_debug(4, "orphan inode %lu will point to %u\n", i_prev->i_ino, ino_next); err = ext4_reserve_inode_write(handle, i_prev, &iloc2); @@ -195,8 +196,8 @@ index 5fcaa85b6dc5..0486fbafb808 100644 goto out_brelse; + } NEXT_ORPHAN(i_prev) = ino_next; -+ mutex_unlock(&sbi->s_orphan_lock); err = ext4_mark_iloc_dirty(handle, i_prev, &iloc2); ++ mutex_unlock(&sbi->s_orphan_lock); } if (err) goto out_brelse; @@ -210,7 +211,3 @@ index 5fcaa85b6dc5..0486fbafb808 100644 return err; out_brelse: --- -1.8.1.4 - - diff --git a/use-sbi-in-ext4_orphan_add_del b/use-sbi-in-ext4_orphan_add_del index 7c0ce413..081cb9a1 100644 --- a/use-sbi-in-ext4_orphan_add_del +++ b/use-sbi-in-ext4_orphan_add_del @@ -1,4 +1,4 @@ -ext4: Use sbi in ext4_orphan_{add|del}() +ext4: use sbi in ext4_orphan_{add|del}() From: Jan Kara @@ -13,10 +13,10 @@ Signed-off-by: "Theodore Ts'o" 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c -index 1cb84f78909e..5fcaa85b6dc5 100644 +index 7ac6167..eb61584 100644 --- a/fs/ext4/namei.c +++ b/fs/ext4/namei.c -@@ -2550,13 +2550,14 @@ static int empty_dir(struct inode *inode) +@@ -2551,13 +2551,14 @@ static int empty_dir(struct inode *inode) int ext4_orphan_add(handle_t *handle, struct inode *inode) { struct super_block *sb = inode->i_sb; @@ -33,7 +33,7 @@ index 1cb84f78909e..5fcaa85b6dc5 100644 if (!list_empty(&EXT4_I(inode)->i_orphan)) goto out_unlock; -@@ -2569,8 +2570,8 @@ int ext4_orphan_add(handle_t *handle, struct inode *inode) +@@ -2570,8 +2571,8 @@ int ext4_orphan_add(handle_t *handle, struct inode *inode) J_ASSERT((S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) || S_ISLNK(inode->i_mode)) || inode->i_nlink == 0); @@ -44,7 +44,7 @@ index 1cb84f78909e..5fcaa85b6dc5 100644 if (err) goto out_unlock; -@@ -2582,12 +2583,12 @@ int ext4_orphan_add(handle_t *handle, struct inode *inode) +@@ -2583,12 +2584,12 @@ int ext4_orphan_add(handle_t *handle, struct inode *inode) * orphan list. If so skip on-disk list modification. */ if (NEXT_ORPHAN(inode) && NEXT_ORPHAN(inode) <= @@ -60,7 +60,7 @@ index 1cb84f78909e..5fcaa85b6dc5 100644 err = ext4_handle_dirty_super(handle, sb); rc = ext4_mark_iloc_dirty(handle, inode, &iloc); if (!err) -@@ -2603,14 +2604,14 @@ int ext4_orphan_add(handle_t *handle, struct inode *inode) +@@ -2604,14 +2605,14 @@ int ext4_orphan_add(handle_t *handle, struct inode *inode) * anyway on the next recovery. */ mem_insert: if (!err) @@ -78,7 +78,7 @@ index 1cb84f78909e..5fcaa85b6dc5 100644 return err; } -@@ -2622,22 +2623,20 @@ int ext4_orphan_del(handle_t *handle, struct inode *inode) +@@ -2623,22 +2624,20 @@ int ext4_orphan_del(handle_t *handle, struct inode *inode) { struct list_head *prev; struct ext4_inode_info *ei = EXT4_I(inode); @@ -104,7 +104,7 @@ index 1cb84f78909e..5fcaa85b6dc5 100644 jbd_debug(4, "remove inode %lu from orphan list\n", inode->i_ino); -@@ -2683,7 +2682,7 @@ int ext4_orphan_del(handle_t *handle, struct inode *inode) +@@ -2684,7 +2683,7 @@ int ext4_orphan_del(handle_t *handle, struct inode *inode) out_err: ext4_std_error(inode->i_sb, err); out: @@ -113,11 +113,3 @@ index 1cb84f78909e..5fcaa85b6dc5 100644 return err; out_brelse: --- -1.8.1.4 - --- -To unsubscribe from this list: send the line "unsubscribe linux-ext4" in -the body of a message to majordomo@vger.kernel.org -More majordomo info at http://vger.kernel.org/majordomo-info.html - -- 2.11.4.GIT