From 287ab894485b98f216c3ab829387d5703e810e6a Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Fri, 30 Sep 2016 02:09:23 -0400 Subject: [PATCH] add patch create-function-to-read-journal-inode --- create-function-to-read-journal-inode | 77 +++++++++++++++++++++++++++++++++++ series | 2 + timestamps | 7 ++-- 3 files changed, 83 insertions(+), 3 deletions(-) create mode 100644 create-function-to-read-journal-inode diff --git a/create-function-to-read-journal-inode b/create-function-to-read-journal-inode new file mode 100644 index 00000000..e4966678 --- /dev/null +++ b/create-function-to-read-journal-inode @@ -0,0 +1,77 @@ +ext4: create function to read journal inode + +From: Eric Whitney + +Factor out the code used in ext4_get_journal() to read a valid journal +inode from storage, enabling its reuse in other functions. + +Signed-off-by: Eric Whitney +Signed-off-by: Theodore Ts'o +--- + fs/ext4/super.c | 32 +++++++++++++++++++++++--------- + 1 file changed, 23 insertions(+), 9 deletions(-) + +diff --git a/fs/ext4/super.c b/fs/ext4/super.c +index 50912cc..4b0ca25 100644 +--- a/fs/ext4/super.c ++++ b/fs/ext4/super.c +@@ -78,6 +78,8 @@ static int ext4_feature_set_ok(struct super_block *sb, int readonly); + static void ext4_destroy_lazyinit_thread(void); + static void ext4_unregister_li_request(struct super_block *sb); + static void ext4_clear_request_list(void); ++static struct inode *ext4_get_journal_inode(struct super_block *sb, ++ unsigned int journal_inum); + + /* + * Lock ordering +@@ -4237,18 +4239,16 @@ static void ext4_init_journal_params(struct super_block *sb, journal_t *journal) + write_unlock(&journal->j_state_lock); + } + +-static journal_t *ext4_get_journal(struct super_block *sb, +- unsigned int journal_inum) ++static struct inode *ext4_get_journal_inode(struct super_block *sb, ++ unsigned int journal_inum) + { + struct inode *journal_inode; +- journal_t *journal; +- +- BUG_ON(!ext4_has_feature_journal(sb)); +- +- /* First, test for the existence of a valid inode on disk. Bad +- * things happen if we iget() an unused inode, as the subsequent +- * iput() will try to delete it. */ + ++ /* ++ * Test for the existence of a valid inode on disk. Bad things ++ * happen if we iget() an unused inode, as the subsequent iput() ++ * will try to delete it. ++ */ + journal_inode = ext4_iget(sb, journal_inum); + if (IS_ERR(journal_inode)) { + ext4_msg(sb, KERN_ERR, "no journal found"); +@@ -4268,6 +4268,20 @@ static journal_t *ext4_get_journal(struct super_block *sb, + iput(journal_inode); + return NULL; + } ++ return journal_inode; ++} ++ ++static journal_t *ext4_get_journal(struct super_block *sb, ++ unsigned int journal_inum) ++{ ++ struct inode *journal_inode; ++ journal_t *journal; ++ ++ BUG_ON(!ext4_has_feature_journal(sb)); ++ ++ journal_inode = ext4_get_journal_inode(sb, journal_inum); ++ if (!journal_inode) ++ return NULL; + + journal = jbd2_journal_init_inode(journal_inode); + if (!journal) { +-- +2.1.4 + + diff --git a/series b/series index 8b6709d3..ba9f2b1a 100644 --- a/series +++ b/series @@ -40,6 +40,8 @@ allow-unlocked-direct-IO-when-pages-are-cached remove-plugging-from-ext4-file-write-iter unmap-metadata-when-zeroing-blocks +create-function-to-read-journal-inode + #################################################### # unstable patches #################################################### diff --git a/timestamps b/timestamps index 2106770e..dd4ceca3 100755 --- a/timestamps +++ b/timestamps @@ -76,7 +76,8 @@ touch -d @1475214438 stable-boundary touch -d @1475214595 require-encryption-feature-for-EXT4_IOC_SET_ENCRYPTION_POLICY touch -d @1475214932 allow-unlocked-direct-IO-when-pages-are-cached touch -d @1475215061 remove-plugging-from-ext4-file-write-iter -touch -d @1475215102 status touch -d @1475215349 unmap-metadata-when-zeroing-blocks -touch -d @1475215410 series -touch -d @1475215414 timestamps +touch -d @1475215509 create-function-to-read-journal-inode +touch -d @1475215540 series +touch -d @1475215545 status +touch -d @1475215754 timestamps -- 2.11.4.GIT