mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-16 02:01:18 -04:00
ext2: Track metadata bhs in fs-private inode part
Track metadata bhs for an inode in fs-private part of the inode. Signed-off-by: Jan Kara <jack@suse.cz> Link: https://patch.msgid.link/20260326095354.16340-76-jack@suse.cz Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
committed by
Christian Brauner
parent
a8c8122a3d
commit
b0439bbc29
@@ -676,6 +676,7 @@ struct ext2_inode_info {
|
||||
#ifdef CONFIG_QUOTA
|
||||
struct dquot __rcu *i_dquot[MAXQUOTAS];
|
||||
#endif
|
||||
struct mapping_metadata_bhs i_metadata_bhs;
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
@@ -156,9 +156,11 @@ static int ext2_release_file (struct inode * inode, struct file * filp)
|
||||
int ext2_fsync(struct file *file, loff_t start, loff_t end, int datasync)
|
||||
{
|
||||
int ret;
|
||||
struct super_block *sb = file->f_mapping->host->i_sb;
|
||||
struct inode *inode = file->f_mapping->host;
|
||||
struct super_block *sb = inode->i_sb;
|
||||
|
||||
ret = generic_buffers_fsync(file, start, end, datasync);
|
||||
ret = mmb_fsync(file, &EXT2_I(inode)->i_metadata_bhs,
|
||||
start, end, datasync);
|
||||
if (ret == -EIO)
|
||||
/* We don't really know where the IO error happened... */
|
||||
ext2_error(sb, __func__,
|
||||
|
||||
@@ -95,9 +95,9 @@ void ext2_evict_inode(struct inode * inode)
|
||||
ext2_truncate_blocks(inode, 0);
|
||||
ext2_xattr_delete_inode(inode);
|
||||
} else {
|
||||
sync_mapping_buffers(&inode->i_data);
|
||||
mmb_sync(&EXT2_I(inode)->i_metadata_bhs);
|
||||
}
|
||||
invalidate_inode_buffers(inode);
|
||||
mmb_invalidate(&EXT2_I(inode)->i_metadata_bhs);
|
||||
clear_inode(inode);
|
||||
|
||||
ext2_discard_reservation(inode);
|
||||
@@ -527,7 +527,7 @@ static int ext2_alloc_branch(struct inode *inode,
|
||||
}
|
||||
set_buffer_uptodate(bh);
|
||||
unlock_buffer(bh);
|
||||
mark_buffer_dirty_inode(bh, inode);
|
||||
mmb_mark_buffer_dirty(bh, &EXT2_I(inode)->i_metadata_bhs);
|
||||
/* We used to sync bh here if IS_SYNC(inode).
|
||||
* But we now rely upon generic_write_sync()
|
||||
* and b_inode_buffers. But not for directories.
|
||||
@@ -598,7 +598,7 @@ static void ext2_splice_branch(struct inode *inode,
|
||||
|
||||
/* had we spliced it onto indirect block? */
|
||||
if (where->bh)
|
||||
mark_buffer_dirty_inode(where->bh, inode);
|
||||
mmb_mark_buffer_dirty(where->bh, &EXT2_I(inode)->i_metadata_bhs);
|
||||
|
||||
inode_set_ctime_current(inode);
|
||||
mark_inode_dirty(inode);
|
||||
@@ -1211,7 +1211,8 @@ static void __ext2_truncate_blocks(struct inode *inode, loff_t offset)
|
||||
if (partial == chain)
|
||||
mark_inode_dirty(inode);
|
||||
else
|
||||
mark_buffer_dirty_inode(partial->bh, inode);
|
||||
mmb_mark_buffer_dirty(partial->bh,
|
||||
&EXT2_I(inode)->i_metadata_bhs);
|
||||
ext2_free_branches(inode, &nr, &nr+1, (chain+n-1) - partial);
|
||||
}
|
||||
/* Clear the ends of indirect blocks on the shared branch */
|
||||
@@ -1220,7 +1221,8 @@ static void __ext2_truncate_blocks(struct inode *inode, loff_t offset)
|
||||
partial->p + 1,
|
||||
(__le32*)partial->bh->b_data+addr_per_block,
|
||||
(chain+n-1) - partial);
|
||||
mark_buffer_dirty_inode(partial->bh, inode);
|
||||
mmb_mark_buffer_dirty(partial->bh,
|
||||
&EXT2_I(inode)->i_metadata_bhs);
|
||||
brelse (partial->bh);
|
||||
partial--;
|
||||
}
|
||||
@@ -1303,7 +1305,7 @@ static int ext2_setsize(struct inode *inode, loff_t newsize)
|
||||
|
||||
inode_set_mtime_to_ts(inode, inode_set_ctime_current(inode));
|
||||
if (inode_needs_sync(inode)) {
|
||||
sync_mapping_buffers(inode->i_mapping);
|
||||
mmb_sync(&EXT2_I(inode)->i_metadata_bhs);
|
||||
sync_inode_metadata(inode, 1);
|
||||
} else {
|
||||
mark_inode_dirty(inode);
|
||||
|
||||
@@ -215,6 +215,7 @@ static struct inode *ext2_alloc_inode(struct super_block *sb)
|
||||
#ifdef CONFIG_QUOTA
|
||||
memset(&ei->i_dquot, 0, sizeof(ei->i_dquot));
|
||||
#endif
|
||||
mmb_init(&ei->i_metadata_bhs, &ei->vfs_inode.i_data);
|
||||
|
||||
return &ei->vfs_inode;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user