Commit 68142cb6 authored by Ryusuke Konishi's avatar Ryusuke Konishi Committed by Andrew Morton

nilfs2: do not call inode_attach_wb() directly

Call mark_buffer_dirty() for segment summary and super root block buffers
on the backing device's page cache, thereby indirectly calling
inode_attach_wb().

Then remove the no longer needed call to inode_attach_wb() in
nilfs_attach_log_writer(), resolving the concern about its layer-violating
use.

Link: https://lkml.kernel.org/r/20240610160029.7673-3-konishi.ryusuke@gmail.comSigned-off-by: default avatarRyusuke Konishi <konishi.ryusuke@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 25fa5f99
...@@ -1678,6 +1678,7 @@ static void nilfs_prepare_write_logs(struct list_head *logs, u32 seed) ...@@ -1678,6 +1678,7 @@ static void nilfs_prepare_write_logs(struct list_head *logs, u32 seed)
list_for_each_entry(segbuf, logs, sb_list) { list_for_each_entry(segbuf, logs, sb_list) {
list_for_each_entry(bh, &segbuf->sb_segsum_buffers, list_for_each_entry(bh, &segbuf->sb_segsum_buffers,
b_assoc_buffers) { b_assoc_buffers) {
mark_buffer_dirty(bh);
if (bh->b_folio == bd_folio) if (bh->b_folio == bd_folio)
continue; continue;
if (bd_folio) { if (bd_folio) {
...@@ -1694,6 +1695,7 @@ static void nilfs_prepare_write_logs(struct list_head *logs, u32 seed) ...@@ -1694,6 +1695,7 @@ static void nilfs_prepare_write_logs(struct list_head *logs, u32 seed)
/* Prepare to write super root block */ /* Prepare to write super root block */
bh = NILFS_LAST_SEGBUF(logs)->sb_super_root; bh = NILFS_LAST_SEGBUF(logs)->sb_super_root;
if (bh) { if (bh) {
mark_buffer_dirty(bh);
if (bh->b_folio != bd_folio) { if (bh->b_folio != bd_folio) {
folio_lock(bd_folio); folio_lock(bd_folio);
folio_wait_writeback(bd_folio); folio_wait_writeback(bd_folio);
...@@ -2843,8 +2845,6 @@ int nilfs_attach_log_writer(struct super_block *sb, struct nilfs_root *root) ...@@ -2843,8 +2845,6 @@ int nilfs_attach_log_writer(struct super_block *sb, struct nilfs_root *root)
if (!nilfs->ns_writer) if (!nilfs->ns_writer)
return -ENOMEM; return -ENOMEM;
inode_attach_wb(nilfs->ns_bdev->bd_mapping->host, NULL);
err = nilfs_segctor_start_thread(nilfs->ns_writer); err = nilfs_segctor_start_thread(nilfs->ns_writer);
if (unlikely(err)) if (unlikely(err))
nilfs_detach_log_writer(sb); nilfs_detach_log_writer(sb);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment