* [PATCH] ext4: uninline ext4_inode_journal_mode()
@ 2019-12-09 23:36 Eric Biggers
2019-12-13 10:44 ` Jan Kara
2020-01-13 18:54 ` Theodore Y. Ts'o
0 siblings, 2 replies; 3+ messages in thread
From: Eric Biggers @ 2019-12-09 23:36 UTC (permalink / raw)
To: linux-ext4
From: Eric Biggers <ebiggers@google.com>
Determining an inode's journaling mode has gotten more complicated over
time. Move ext4_inode_journal_mode() from an inline function into
ext4_jbd2.c to reduce the compiled code size.
Signed-off-by: Eric Biggers <ebiggers@google.com>
---
fs/ext4/ext4_jbd2.c | 22 ++++++++++++++++++++++
fs/ext4/ext4_jbd2.h | 22 +---------------------
2 files changed, 23 insertions(+), 21 deletions(-)
diff --git a/fs/ext4/ext4_jbd2.c b/fs/ext4/ext4_jbd2.c
index d3b8cdea5df75..621c9e19d081f 100644
--- a/fs/ext4/ext4_jbd2.c
+++ b/fs/ext4/ext4_jbd2.c
@@ -7,6 +7,28 @@
#include <trace/events/ext4.h>
+int ext4_inode_journal_mode(struct inode *inode)
+{
+ if (EXT4_JOURNAL(inode) == NULL)
+ return EXT4_INODE_WRITEBACK_DATA_MODE; /* writeback */
+ /* We do not support data journalling with delayed allocation */
+ if (!S_ISREG(inode->i_mode) ||
+ ext4_test_inode_flag(inode, EXT4_INODE_EA_INODE) ||
+ test_opt(inode->i_sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA ||
+ (ext4_test_inode_flag(inode, EXT4_INODE_JOURNAL_DATA) &&
+ !test_opt(inode->i_sb, DELALLOC))) {
+ /* We do not support data journalling for encrypted data */
+ if (S_ISREG(inode->i_mode) && IS_ENCRYPTED(inode))
+ return EXT4_INODE_ORDERED_DATA_MODE; /* ordered */
+ return EXT4_INODE_JOURNAL_DATA_MODE; /* journal data */
+ }
+ if (test_opt(inode->i_sb, DATA_FLAGS) == EXT4_MOUNT_ORDERED_DATA)
+ return EXT4_INODE_ORDERED_DATA_MODE; /* ordered */
+ if (test_opt(inode->i_sb, DATA_FLAGS) == EXT4_MOUNT_WRITEBACK_DATA)
+ return EXT4_INODE_WRITEBACK_DATA_MODE; /* writeback */
+ BUG();
+}
+
/* Just increment the non-pointer handle value */
static handle_t *ext4_get_nojournal(void)
{
diff --git a/fs/ext4/ext4_jbd2.h b/fs/ext4/ext4_jbd2.h
index a6b9b66dbfade..7ea4f6fa173b4 100644
--- a/fs/ext4/ext4_jbd2.h
+++ b/fs/ext4/ext4_jbd2.h
@@ -463,27 +463,7 @@ int ext4_force_commit(struct super_block *sb);
#define EXT4_INODE_ORDERED_DATA_MODE 0x02 /* ordered data mode */
#define EXT4_INODE_WRITEBACK_DATA_MODE 0x04 /* writeback data mode */
-static inline int ext4_inode_journal_mode(struct inode *inode)
-{
- if (EXT4_JOURNAL(inode) == NULL)
- return EXT4_INODE_WRITEBACK_DATA_MODE; /* writeback */
- /* We do not support data journalling with delayed allocation */
- if (!S_ISREG(inode->i_mode) ||
- ext4_test_inode_flag(inode, EXT4_INODE_EA_INODE) ||
- test_opt(inode->i_sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA ||
- (ext4_test_inode_flag(inode, EXT4_INODE_JOURNAL_DATA) &&
- !test_opt(inode->i_sb, DELALLOC))) {
- /* We do not support data journalling for encrypted data */
- if (S_ISREG(inode->i_mode) && IS_ENCRYPTED(inode))
- return EXT4_INODE_ORDERED_DATA_MODE; /* ordered */
- return EXT4_INODE_JOURNAL_DATA_MODE; /* journal data */
- }
- if (test_opt(inode->i_sb, DATA_FLAGS) == EXT4_MOUNT_ORDERED_DATA)
- return EXT4_INODE_ORDERED_DATA_MODE; /* ordered */
- if (test_opt(inode->i_sb, DATA_FLAGS) == EXT4_MOUNT_WRITEBACK_DATA)
- return EXT4_INODE_WRITEBACK_DATA_MODE; /* writeback */
- BUG();
-}
+int ext4_inode_journal_mode(struct inode *inode);
static inline int ext4_should_journal_data(struct inode *inode)
{
--
2.24.0.393.g34dc348eaf-goog
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] ext4: uninline ext4_inode_journal_mode()
2019-12-09 23:36 [PATCH] ext4: uninline ext4_inode_journal_mode() Eric Biggers
@ 2019-12-13 10:44 ` Jan Kara
2020-01-13 18:54 ` Theodore Y. Ts'o
1 sibling, 0 replies; 3+ messages in thread
From: Jan Kara @ 2019-12-13 10:44 UTC (permalink / raw)
To: Eric Biggers; +Cc: linux-ext4, Ted Tso
On Mon 09-12-19 15:36:02, Eric Biggers wrote:
> From: Eric Biggers <ebiggers@google.com>
>
> Determining an inode's journaling mode has gotten more complicated over
> time. Move ext4_inode_journal_mode() from an inline function into
> ext4_jbd2.c to reduce the compiled code size.
>
> Signed-off-by: Eric Biggers <ebiggers@google.com>
Yeah, you're right. The function is pretty big and used quite a lot. Also
I'm not aware of any place where the additional function call would make a
noticeable performance difference. You can add:
Reviewed-by: Jan Kara <jack@suse.cz>
Honza
> ---
> fs/ext4/ext4_jbd2.c | 22 ++++++++++++++++++++++
> fs/ext4/ext4_jbd2.h | 22 +---------------------
> 2 files changed, 23 insertions(+), 21 deletions(-)
>
> diff --git a/fs/ext4/ext4_jbd2.c b/fs/ext4/ext4_jbd2.c
> index d3b8cdea5df75..621c9e19d081f 100644
> --- a/fs/ext4/ext4_jbd2.c
> +++ b/fs/ext4/ext4_jbd2.c
> @@ -7,6 +7,28 @@
>
> #include <trace/events/ext4.h>
>
> +int ext4_inode_journal_mode(struct inode *inode)
> +{
> + if (EXT4_JOURNAL(inode) == NULL)
> + return EXT4_INODE_WRITEBACK_DATA_MODE; /* writeback */
> + /* We do not support data journalling with delayed allocation */
> + if (!S_ISREG(inode->i_mode) ||
> + ext4_test_inode_flag(inode, EXT4_INODE_EA_INODE) ||
> + test_opt(inode->i_sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA ||
> + (ext4_test_inode_flag(inode, EXT4_INODE_JOURNAL_DATA) &&
> + !test_opt(inode->i_sb, DELALLOC))) {
> + /* We do not support data journalling for encrypted data */
> + if (S_ISREG(inode->i_mode) && IS_ENCRYPTED(inode))
> + return EXT4_INODE_ORDERED_DATA_MODE; /* ordered */
> + return EXT4_INODE_JOURNAL_DATA_MODE; /* journal data */
> + }
> + if (test_opt(inode->i_sb, DATA_FLAGS) == EXT4_MOUNT_ORDERED_DATA)
> + return EXT4_INODE_ORDERED_DATA_MODE; /* ordered */
> + if (test_opt(inode->i_sb, DATA_FLAGS) == EXT4_MOUNT_WRITEBACK_DATA)
> + return EXT4_INODE_WRITEBACK_DATA_MODE; /* writeback */
> + BUG();
> +}
> +
> /* Just increment the non-pointer handle value */
> static handle_t *ext4_get_nojournal(void)
> {
> diff --git a/fs/ext4/ext4_jbd2.h b/fs/ext4/ext4_jbd2.h
> index a6b9b66dbfade..7ea4f6fa173b4 100644
> --- a/fs/ext4/ext4_jbd2.h
> +++ b/fs/ext4/ext4_jbd2.h
> @@ -463,27 +463,7 @@ int ext4_force_commit(struct super_block *sb);
> #define EXT4_INODE_ORDERED_DATA_MODE 0x02 /* ordered data mode */
> #define EXT4_INODE_WRITEBACK_DATA_MODE 0x04 /* writeback data mode */
>
> -static inline int ext4_inode_journal_mode(struct inode *inode)
> -{
> - if (EXT4_JOURNAL(inode) == NULL)
> - return EXT4_INODE_WRITEBACK_DATA_MODE; /* writeback */
> - /* We do not support data journalling with delayed allocation */
> - if (!S_ISREG(inode->i_mode) ||
> - ext4_test_inode_flag(inode, EXT4_INODE_EA_INODE) ||
> - test_opt(inode->i_sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA ||
> - (ext4_test_inode_flag(inode, EXT4_INODE_JOURNAL_DATA) &&
> - !test_opt(inode->i_sb, DELALLOC))) {
> - /* We do not support data journalling for encrypted data */
> - if (S_ISREG(inode->i_mode) && IS_ENCRYPTED(inode))
> - return EXT4_INODE_ORDERED_DATA_MODE; /* ordered */
> - return EXT4_INODE_JOURNAL_DATA_MODE; /* journal data */
> - }
> - if (test_opt(inode->i_sb, DATA_FLAGS) == EXT4_MOUNT_ORDERED_DATA)
> - return EXT4_INODE_ORDERED_DATA_MODE; /* ordered */
> - if (test_opt(inode->i_sb, DATA_FLAGS) == EXT4_MOUNT_WRITEBACK_DATA)
> - return EXT4_INODE_WRITEBACK_DATA_MODE; /* writeback */
> - BUG();
> -}
> +int ext4_inode_journal_mode(struct inode *inode);
>
> static inline int ext4_should_journal_data(struct inode *inode)
> {
> --
> 2.24.0.393.g34dc348eaf-goog
>
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] ext4: uninline ext4_inode_journal_mode()
2019-12-09 23:36 [PATCH] ext4: uninline ext4_inode_journal_mode() Eric Biggers
2019-12-13 10:44 ` Jan Kara
@ 2020-01-13 18:54 ` Theodore Y. Ts'o
1 sibling, 0 replies; 3+ messages in thread
From: Theodore Y. Ts'o @ 2020-01-13 18:54 UTC (permalink / raw)
To: Eric Biggers; +Cc: linux-ext4
On Mon, Dec 09, 2019 at 03:36:02PM -0800, Eric Biggers wrote:
> From: Eric Biggers <ebiggers@google.com>
>
> Determining an inode's journaling mode has gotten more complicated over
> time. Move ext4_inode_journal_mode() from an inline function into
> ext4_jbd2.c to reduce the compiled code size.
>
> Signed-off-by: Eric Biggers <ebiggers@google.com>
Thanks, applied.
- Ted
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-01-13 18:55 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-09 23:36 [PATCH] ext4: uninline ext4_inode_journal_mode() Eric Biggers
2019-12-13 10:44 ` Jan Kara
2020-01-13 18:54 ` Theodore Y. Ts'o
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).