* [PATCH 1/2] ext4: create function to read journal inode
@ 2016-09-22 1:14 Eric Whitney
2016-09-22 15:03 ` Jan Kara
2016-09-30 6:11 ` Theodore Ts'o
0 siblings, 2 replies; 4+ messages in thread
From: Eric Whitney @ 2016-09-22 1:14 UTC (permalink / raw)
To: linux-ext4; +Cc: tytso
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 <enwlinux@gmail.com>
---
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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] ext4: create function to read journal inode
2016-09-22 1:14 [PATCH 1/2] ext4: create function to read journal inode Eric Whitney
@ 2016-09-22 15:03 ` Jan Kara
2016-09-22 16:38 ` Eric Whitney
2016-09-30 6:11 ` Theodore Ts'o
1 sibling, 1 reply; 4+ messages in thread
From: Jan Kara @ 2016-09-22 15:03 UTC (permalink / raw)
To: Eric Whitney; +Cc: linux-ext4, tytso
On Wed 21-09-16 21:14:50, Eric Whitney wrote:
> 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 <enwlinux@gmail.com>
Looks good. You can add:
Reviewed-by: Jan Kara <jack@suse.cz>
BTW: I didn't see PATCH 2/2?
Honza
> ---
> 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
>
> --
> 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
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] ext4: create function to read journal inode
2016-09-22 15:03 ` Jan Kara
@ 2016-09-22 16:38 ` Eric Whitney
0 siblings, 0 replies; 4+ messages in thread
From: Eric Whitney @ 2016-09-22 16:38 UTC (permalink / raw)
To: Jan Kara; +Cc: Eric Whitney, linux-ext4, tytso
* Jan Kara <jack@suse.cz>:
> On Wed 21-09-16 21:14:50, Eric Whitney wrote:
> > 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 <enwlinux@gmail.com>
>
> Looks good. You can add:
>
> Reviewed-by: Jan Kara <jack@suse.cz>
>
> BTW: I didn't see PATCH 2/2?
>
Yup, my mistake. I reposted it earlier today - hopefully it's now visible.
Thanks for the review!
Eric
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] ext4: create function to read journal inode
2016-09-22 1:14 [PATCH 1/2] ext4: create function to read journal inode Eric Whitney
2016-09-22 15:03 ` Jan Kara
@ 2016-09-30 6:11 ` Theodore Ts'o
1 sibling, 0 replies; 4+ messages in thread
From: Theodore Ts'o @ 2016-09-30 6:11 UTC (permalink / raw)
To: Eric Whitney; +Cc: linux-ext4
On Wed, Sep 21, 2016 at 09:14:50PM -0400, Eric Whitney wrote:
> 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 <enwlinux@gmail.com>
Thanks, applied.
- Ted
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-09-30 6:11 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-22 1:14 [PATCH 1/2] ext4: create function to read journal inode Eric Whitney
2016-09-22 15:03 ` Jan Kara
2016-09-22 16:38 ` Eric Whitney
2016-09-30 6:11 ` Theodore Ts'o
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.