Skip to content

Commit 025c9af

Browse files
jankarabrauner
authored andcommitted
fs: Switch inode_has_buffers() to take mapping_metadata_bhs
As part of a move towards placing mapping_metadata_bhs in fs-private inode part, switch inode_has_buffers() to take mapping_metadata_bhs and rename the function to mmb_has_buffers(). Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jan Kara <jack@suse.cz> Link: https://patch.msgid.link/20260326095354.16340-74-jack@suse.cz Signed-off-by: Christian Brauner <brauner@kernel.org>
1 parent c86f5d2 commit 025c9af

3 files changed

Lines changed: 9 additions & 9 deletions

File tree

fs/buffer.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ EXPORT_SYMBOL(mark_buffer_async_write);
468468
* written back and waited upon before fsync() returns.
469469
*
470470
* The functions mark_buffer_dirty_inode(), fsync_inode_buffers(),
471-
* inode_has_buffers() and invalidate_inode_buffers() are provided for the
471+
* mmb_has_buffers() and invalidate_inode_buffers() are provided for the
472472
* management of a list of dependent buffers in mapping_metadata_bhs struct.
473473
*
474474
* The locking is a little subtle: The list of buffer heads is protected by
@@ -526,11 +526,11 @@ static void remove_assoc_queue(struct buffer_head *bh)
526526
}
527527
}
528528

529-
int inode_has_buffers(struct inode *inode)
529+
bool mmb_has_buffers(struct mapping_metadata_bhs *mmb)
530530
{
531-
return !list_empty(&inode->i_data.i_metadata_bhs.list);
531+
return !list_empty(&mmb->list);
532532
}
533-
EXPORT_SYMBOL_GPL(inode_has_buffers);
533+
EXPORT_SYMBOL_GPL(mmb_has_buffers);
534534

535535
/**
536536
* sync_mapping_buffers - write out & wait upon a mapping's "associated" buffers
@@ -561,7 +561,7 @@ int sync_mapping_buffers(struct address_space *mapping)
561561
struct blk_plug plug;
562562
LIST_HEAD(tmp);
563563

564-
if (list_empty(&mmb->list))
564+
if (!mmb_has_buffers(mmb))
565565
return 0;
566566

567567
blk_start_plug(&plug);
@@ -803,9 +803,9 @@ EXPORT_SYMBOL(block_dirty_folio);
803803
*/
804804
void invalidate_inode_buffers(struct inode *inode)
805805
{
806-
if (inode_has_buffers(inode)) {
807-
struct mapping_metadata_bhs *mmb = &inode->i_data.i_metadata_bhs;
806+
struct mapping_metadata_bhs *mmb = &inode->i_data.i_metadata_bhs;
808807

808+
if (mmb_has_buffers(mmb)) {
809809
spin_lock(&mmb->lock);
810810
while (!list_empty(&mmb->list))
811811
__remove_assoc_queue(mmb, BH_ENTRY(mmb->list.next));

fs/ext4/inode.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3436,7 +3436,7 @@ static bool ext4_inode_datasync_dirty(struct inode *inode)
34363436
}
34373437

34383438
/* Any metadata buffers to write? */
3439-
if (inode_has_buffers(inode))
3439+
if (mmb_has_buffers(&inode->i_mapping->i_metadata_bhs))
34403440
return true;
34413441
return inode_state_read_once(inode) & I_DIRTY_DATASYNC;
34423442
}

include/linux/buffer_head.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@ bool block_dirty_folio(struct address_space *mapping, struct folio *folio);
515515

516516
void buffer_init(void);
517517
bool try_to_free_buffers(struct folio *folio);
518-
int inode_has_buffers(struct inode *inode);
518+
bool mmb_has_buffers(struct mapping_metadata_bhs *mmb);
519519
void invalidate_inode_buffers(struct inode *inode);
520520
int sync_mapping_buffers(struct address_space *mapping);
521521
void invalidate_bh_lrus(void);

0 commit comments

Comments
 (0)