From: Jan Kara <jack@suse.cz>
To: Ted Tso <tytso@mit.edu>
Cc: <linux-ext4@vger.kernel.org>, Jan Kara <jack@suse.cz>
Subject: [PATCH 1/7] ext4: Update stale comment about write constraints
Date: Wed, 11 Jan 2023 16:43:25 +0100 [thread overview]
Message-ID: <20230111154338.392-1-jack@suse.cz> (raw)
In-Reply-To: <20230111152736.9608-1-jack@suse.cz>
The comment above do_journal_get_write_access() is very stale. Most of
it just does not refer to what the function does today or how jbd2
works. The bit about transaction handling during write(2) is still
correct so just update the function names in that part and move the
comment to a more appropriate place.
Signed-off-by: Jan Kara <jack@suse.cz>
---
fs/ext4/inode.c | 31 +++++++------------------------
1 file changed, 7 insertions(+), 24 deletions(-)
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 9d9f414f99fe..f9201c7d61ad 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -1005,30 +1005,6 @@ int ext4_walk_page_buffers(handle_t *handle, struct inode *inode,
return ret;
}
-/*
- * To preserve ordering, it is essential that the hole instantiation and
- * the data write be encapsulated in a single transaction. We cannot
- * close off a transaction and start a new one between the ext4_get_block()
- * and the commit_write(). So doing the jbd2_journal_start at the start of
- * prepare_write() is the right place.
- *
- * Also, this function can nest inside ext4_writepage(). In that case, we
- * *know* that ext4_writepage() has generated enough buffer credits to do the
- * whole page. So we won't block on the journal in that case, which is good,
- * because the caller may be PF_MEMALLOC.
- *
- * By accident, ext4 can be reentered when a transaction is open via
- * quota file writes. If we were to commit the transaction while thus
- * reentered, there can be a deadlock - we would be holding a quota
- * lock, and the commit would never complete if another thread had a
- * transaction open and was blocking on the quota lock - a ranking
- * violation.
- *
- * So what we do is to rely on the fact that jbd2_journal_stop/journal_start
- * will _not_ run commit under these circumstances because handle->h_ref
- * is elevated. We'll still have enough credits for the tiny quotafile
- * write.
- */
int do_journal_get_write_access(handle_t *handle, struct inode *inode,
struct buffer_head *bh)
{
@@ -1149,6 +1125,13 @@ static int ext4_block_write_begin(struct page *page, loff_t pos, unsigned len,
}
#endif
+/*
+ * To preserve ordering, it is essential that the hole instantiation and
+ * the data write be encapsulated in a single transaction. We cannot
+ * close off a transaction and start a new one between the ext4_get_block()
+ * and the ext4_write_end(). So doing the jbd2_journal_start at the start of
+ * ext4_write_begin() is the right place.
+ */
static int ext4_write_begin(struct file *file, struct address_space *mapping,
loff_t pos, unsigned len,
struct page **pagep, void **fsdata)
--
2.35.3
next prev parent reply other threads:[~2023-01-11 15:46 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-11 15:43 [PATCH 0/7] ext4: Cleanup data=journal writeback path Jan Kara
2023-01-11 15:43 ` Jan Kara [this message]
2023-01-11 15:43 ` [PATCH 2/7] ext4: Use nr_to_write directly in mpage_prepare_extent_to_map() Jan Kara
2023-01-11 15:43 ` [PATCH 3/7] ext4: Mark page for delayed dirtying only if it is pinned Jan Kara
2023-01-11 22:34 ` kernel test robot
2023-01-12 1:36 ` kernel test robot
2023-01-12 2:07 ` kernel test robot
2023-01-12 9:29 ` Jan Kara
2023-01-11 15:43 ` [PATCH 4/7] ext4: Don't unlock page in ext4_bio_write_page() Jan Kara
2023-01-11 15:43 ` [PATCH 5/7] ext4: Move page unlocking out of mpage_submit_page() Jan Kara
2023-01-11 15:43 ` [PATCH 6/7] ext4: Move mpage_page_done() calls after error handling Jan Kara
2023-01-11 15:43 ` [PATCH 7/7] ext4: Convert data=journal writeback to use ext4_writepages() Jan Kara
2023-02-19 5:40 ` [PATCH 0/7] ext4: Cleanup data=journal writeback path Theodore Ts'o
-- strict thread matches above, loose matches on Subject: below --
2023-02-28 5:13 [PATCH REBASED " Theodore Ts'o
2023-02-28 5:13 ` [PATCH 1/7] ext4: Update stale comment about write constraints Theodore Ts'o
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=20230111154338.392-1-jack@suse.cz \
--to=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 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.