From: Harshad Shirwadkar <harshadshirwadkar@gmail.com>
To: linux-ext4@vger.kernel.org
Cc: tytso@mit.edu, Harshad Shirwadkar <harshadshirwadkar@gmail.com>,
Jan Kara <jack@suse.cz>
Subject: [PATCH v2 02/22] ext4: mark fc ineligible if inode gets evictied due to mem pressure
Date: Thu, 5 Nov 2020 19:58:51 -0800 [thread overview]
Message-ID: <20201106035911.1942128-3-harshadshirwadkar@gmail.com> (raw)
In-Reply-To: <20201106035911.1942128-1-harshadshirwadkar@gmail.com>
If inode gets evicted due to memory pressure, we have to remove it
from the fast commit list. However, that inode may have uncommitted
changes that fast commits will lose. So, just fall back to full
commits in this case. Also, rename the fast commit ineligiblity reason
from "EXT4_FC_REASON_MEM" to "EXT4_FC_REASON_MEM_NOMEM" for better
expression.
Suggested-by: Jan Kara <jack@suse.cz>
Signed-off-by: Harshad Shirwadkar <harshadshirwadkar@gmail.com>
---
fs/ext4/fast_commit.c | 4 ++--
fs/ext4/fast_commit.h | 2 +-
fs/ext4/inode.c | 2 ++
include/trace/events/ext4.h | 6 +++---
4 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/fs/ext4/fast_commit.c b/fs/ext4/fast_commit.c
index 8d43058386c3..48b7bc129392 100644
--- a/fs/ext4/fast_commit.c
+++ b/fs/ext4/fast_commit.c
@@ -384,7 +384,7 @@ static int __track_dentry_update(struct inode *inode, void *arg, bool update)
mutex_unlock(&ei->i_fc_lock);
node = kmem_cache_alloc(ext4_fc_dentry_cachep, GFP_NOFS);
if (!node) {
- ext4_fc_mark_ineligible(inode->i_sb, EXT4_FC_REASON_MEM);
+ ext4_fc_mark_ineligible(inode->i_sb, EXT4_FC_REASON_NOMEM);
mutex_lock(&ei->i_fc_lock);
return -ENOMEM;
}
@@ -397,7 +397,7 @@ static int __track_dentry_update(struct inode *inode, void *arg, bool update)
if (!node->fcd_name.name) {
kmem_cache_free(ext4_fc_dentry_cachep, node);
ext4_fc_mark_ineligible(inode->i_sb,
- EXT4_FC_REASON_MEM);
+ EXT4_FC_REASON_NOMEM);
mutex_lock(&ei->i_fc_lock);
return -ENOMEM;
}
diff --git a/fs/ext4/fast_commit.h b/fs/ext4/fast_commit.h
index 06907d485989..140fbb6af19e 100644
--- a/fs/ext4/fast_commit.h
+++ b/fs/ext4/fast_commit.h
@@ -100,7 +100,7 @@ enum {
EXT4_FC_REASON_XATTR = 0,
EXT4_FC_REASON_CROSS_RENAME,
EXT4_FC_REASON_JOURNAL_FLAG_CHANGE,
- EXT4_FC_REASON_MEM,
+ EXT4_FC_REASON_NOMEM,
EXT4_FC_REASON_SWAP_BOOT,
EXT4_FC_REASON_RESIZE,
EXT4_FC_REASON_RENAME_DIR,
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index b96a18679a27..081b6a86b5db 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -327,6 +327,8 @@ void ext4_evict_inode(struct inode *inode)
ext4_xattr_inode_array_free(ea_inode_array);
return;
no_delete:
+ if (!list_empty(&EXT4_I(inode)->i_fc_list))
+ ext4_fc_mark_ineligible(inode->i_sb, EXT4_FC_REASON_NOMEM);
ext4_clear_inode(inode); /* We must guarantee clearing of inode... */
}
diff --git a/include/trace/events/ext4.h b/include/trace/events/ext4.h
index b14314fcf732..0f899d3b09d3 100644
--- a/include/trace/events/ext4.h
+++ b/include/trace/events/ext4.h
@@ -100,7 +100,7 @@ TRACE_DEFINE_ENUM(ES_REFERENCED_B);
{ EXT4_FC_REASON_XATTR, "XATTR"}, \
{ EXT4_FC_REASON_CROSS_RENAME, "CROSS_RENAME"}, \
{ EXT4_FC_REASON_JOURNAL_FLAG_CHANGE, "JOURNAL_FLAG_CHANGE"}, \
- { EXT4_FC_REASON_MEM, "NO_MEM"}, \
+ { EXT4_FC_REASON_NOMEM, "NO_MEM"}, \
{ EXT4_FC_REASON_SWAP_BOOT, "SWAP_BOOT"}, \
{ EXT4_FC_REASON_RESIZE, "RESIZE"}, \
{ EXT4_FC_REASON_RENAME_DIR, "RENAME_DIR"}, \
@@ -2917,13 +2917,13 @@ TRACE_EVENT(ext4_fc_stats,
),
TP_printk("dev %d:%d fc ineligible reasons:\n"
- "%s:%d, %s:%d, %s:%d, %s:%d, %s:%d, %s:%d, %s:%d, %s,%d; "
+ "%s:%d, %s:%d, %s:%d, %s:%d, %s:%d, %s:%d, %s:%d, %s:%d; "
"num_commits:%ld, ineligible: %ld, numblks: %ld",
MAJOR(__entry->dev), MINOR(__entry->dev),
FC_REASON_NAME_STAT(EXT4_FC_REASON_XATTR),
FC_REASON_NAME_STAT(EXT4_FC_REASON_CROSS_RENAME),
FC_REASON_NAME_STAT(EXT4_FC_REASON_JOURNAL_FLAG_CHANGE),
- FC_REASON_NAME_STAT(EXT4_FC_REASON_MEM),
+ FC_REASON_NAME_STAT(EXT4_FC_REASON_NOMEM),
FC_REASON_NAME_STAT(EXT4_FC_REASON_SWAP_BOOT),
FC_REASON_NAME_STAT(EXT4_FC_REASON_RESIZE),
FC_REASON_NAME_STAT(EXT4_FC_REASON_RENAME_DIR),
--
2.29.1.341.ge80a0c044ae-goog
next prev parent reply other threads:[~2020-11-06 3:59 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-06 3:58 [PATCH v2 00/22] ext4 fast commit fixes Harshad Shirwadkar
2020-11-06 3:58 ` [PATCH v2 01/22] ext4: describe fast_commit feature flags Harshad Shirwadkar
2020-11-06 3:58 ` Harshad Shirwadkar [this message]
2020-11-06 3:58 ` [PATCH v2 03/22] ext4: drop redundant calls ext4_fc_track_range Harshad Shirwadkar
2020-11-06 3:58 ` [PATCH v2 04/22] ext4: fixup ext4_fc_track_* functions' signature Harshad Shirwadkar
2020-11-06 3:58 ` [PATCH v2 05/22] jbd2: rename j_maxlen to j_total_len and add jbd2_journal_max_txn_bufs Harshad Shirwadkar
2020-11-06 3:58 ` [PATCH v2 06/22] ext4: clean up the JBD2 API that initializes fast commits Harshad Shirwadkar
2020-11-06 3:58 ` [PATCH v2 07/22] jbd2: drop jbd2_fc_init documentation Harshad Shirwadkar
2020-11-06 3:58 ` [PATCH v2 08/22] jbd2: don't use state lock during commit path Harshad Shirwadkar
2020-11-06 3:58 ` [PATCH v2 09/22] jbd2: don't pass tid to jbd2_fc_end_commit_fallback() Harshad Shirwadkar
2020-11-06 3:58 ` [PATCH v2 10/22] jbd2: add todo for a fast commit performance optimization Harshad Shirwadkar
2020-11-06 3:59 ` [PATCH v2 11/22] jbd2: don't touch buffer state until it is filled Harshad Shirwadkar
2020-11-06 3:59 ` [PATCH v2 12/22] jbd2: don't read journal->j_commit_sequence without taking a lock Harshad Shirwadkar
2020-11-06 3:59 ` [PATCH v2 13/22] ext4: dedpulicate the code to wait on inode that's being committed Harshad Shirwadkar
2020-11-06 3:59 ` [PATCH v2 14/22] ext4: fix code documentatioon Harshad Shirwadkar
2020-11-06 3:59 ` [PATCH v2 15/22] ext4: mark buf dirty before submitting fast commit buffer Harshad Shirwadkar
2020-11-06 3:59 ` [PATCH v2 16/22] ext4: remove unnecessary fast commit calls from ext4_file_mmap Harshad Shirwadkar
2020-11-06 3:59 ` [PATCH v2 17/22] ext4: fix inode dirty check in case of fast commits Harshad Shirwadkar
2020-11-06 3:59 ` [PATCH v2 18/22] ext4: disable fast commit with data journalling Harshad Shirwadkar
2020-11-06 3:59 ` [PATCH v2 19/22] ext4: issue fsdev cache flush before starting fast commit Harshad Shirwadkar
2020-11-06 3:59 ` [PATCH v2 20/22] ext4: make s_mount_flags modifications atomic Harshad Shirwadkar
2020-11-06 3:59 ` [PATCH v2 21/22] jbd2: don't start fast commit on aborted journal Harshad Shirwadkar
2020-11-06 3:59 ` [PATCH v2 22/22] ext4: cleanup fast commit mount options Harshad Shirwadkar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201106035911.1942128-3-harshadshirwadkar@gmail.com \
--to=harshadshirwadkar@gmail.com \
--cc=jack@suse.cz \
--cc=linux-ext4@vger.kernel.org \
--cc=tytso@mit.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).