Skip to content

Commit f92f8ed

Browse files
Christoph Hellwigbrauner
authored andcommitted
xfs: implement ->sync_lazytime
Switch to the new explicit lazytime syncing method instead of trying to second guess what could be a lazytime update in ->dirty_inode. Signed-off-by: Christoph Hellwig <hch@lst.de> Link: https://patch.msgid.link/20260108141934.2052404-11-hch@lst.de Reviewed-by: Jeff Layton <jlayton@kernel.org> Signed-off-by: Christian Brauner <brauner@kernel.org>
1 parent 2d72003 commit f92f8ed

2 files changed

Lines changed: 20 additions & 29 deletions

File tree

fs/xfs/xfs_iops.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1221,6 +1221,22 @@ xfs_vn_update_time(
12211221
return xfs_trans_commit(tp);
12221222
}
12231223

1224+
static void
1225+
xfs_vn_sync_lazytime(
1226+
struct inode *inode)
1227+
{
1228+
struct xfs_inode *ip = XFS_I(inode);
1229+
struct xfs_mount *mp = ip->i_mount;
1230+
struct xfs_trans *tp;
1231+
1232+
if (xfs_trans_alloc(mp, &M_RES(mp)->tr_fsyncts, 0, 0, 0, &tp))
1233+
return;
1234+
xfs_ilock(ip, XFS_ILOCK_EXCL);
1235+
xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL);
1236+
xfs_trans_log_inode(tp, ip, XFS_ILOG_TIMESTAMP);
1237+
xfs_trans_commit(tp);
1238+
}
1239+
12241240
STATIC int
12251241
xfs_vn_fiemap(
12261242
struct inode *inode,
@@ -1264,6 +1280,7 @@ static const struct inode_operations xfs_inode_operations = {
12641280
.listxattr = xfs_vn_listxattr,
12651281
.fiemap = xfs_vn_fiemap,
12661282
.update_time = xfs_vn_update_time,
1283+
.sync_lazytime = xfs_vn_sync_lazytime,
12671284
.fileattr_get = xfs_fileattr_get,
12681285
.fileattr_set = xfs_fileattr_set,
12691286
};
@@ -1290,6 +1307,7 @@ static const struct inode_operations xfs_dir_inode_operations = {
12901307
.setattr = xfs_vn_setattr,
12911308
.listxattr = xfs_vn_listxattr,
12921309
.update_time = xfs_vn_update_time,
1310+
.sync_lazytime = xfs_vn_sync_lazytime,
12931311
.tmpfile = xfs_vn_tmpfile,
12941312
.fileattr_get = xfs_fileattr_get,
12951313
.fileattr_set = xfs_fileattr_set,
@@ -1317,6 +1335,7 @@ static const struct inode_operations xfs_dir_ci_inode_operations = {
13171335
.setattr = xfs_vn_setattr,
13181336
.listxattr = xfs_vn_listxattr,
13191337
.update_time = xfs_vn_update_time,
1338+
.sync_lazytime = xfs_vn_sync_lazytime,
13201339
.tmpfile = xfs_vn_tmpfile,
13211340
.fileattr_get = xfs_fileattr_get,
13221341
.fileattr_set = xfs_fileattr_set,
@@ -1328,6 +1347,7 @@ static const struct inode_operations xfs_symlink_inode_operations = {
13281347
.setattr = xfs_vn_setattr,
13291348
.listxattr = xfs_vn_listxattr,
13301349
.update_time = xfs_vn_update_time,
1350+
.sync_lazytime = xfs_vn_sync_lazytime,
13311351
.fileattr_get = xfs_fileattr_get,
13321352
.fileattr_set = xfs_fileattr_set,
13331353
};

fs/xfs/xfs_super.c

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -712,34 +712,6 @@ xfs_fs_destroy_inode(
712712
xfs_inode_mark_reclaimable(ip);
713713
}
714714

715-
static void
716-
xfs_fs_dirty_inode(
717-
struct inode *inode,
718-
int flags)
719-
{
720-
struct xfs_inode *ip = XFS_I(inode);
721-
struct xfs_mount *mp = ip->i_mount;
722-
struct xfs_trans *tp;
723-
724-
if (!(inode->i_sb->s_flags & SB_LAZYTIME))
725-
return;
726-
727-
/*
728-
* Only do the timestamp update if the inode is dirty (I_DIRTY_SYNC)
729-
* and has dirty timestamp (I_DIRTY_TIME). I_DIRTY_TIME can be passed
730-
* in flags possibly together with I_DIRTY_SYNC.
731-
*/
732-
if ((flags & ~I_DIRTY_TIME) != I_DIRTY_SYNC || !(flags & I_DIRTY_TIME))
733-
return;
734-
735-
if (xfs_trans_alloc(mp, &M_RES(mp)->tr_fsyncts, 0, 0, 0, &tp))
736-
return;
737-
xfs_ilock(ip, XFS_ILOCK_EXCL);
738-
xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL);
739-
xfs_trans_log_inode(tp, ip, XFS_ILOG_TIMESTAMP);
740-
xfs_trans_commit(tp);
741-
}
742-
743715
/*
744716
* Slab object creation initialisation for the XFS inode.
745717
* This covers only the idempotent fields in the XFS inode;
@@ -1304,7 +1276,6 @@ xfs_fs_show_stats(
13041276
static const struct super_operations xfs_super_operations = {
13051277
.alloc_inode = xfs_fs_alloc_inode,
13061278
.destroy_inode = xfs_fs_destroy_inode,
1307-
.dirty_inode = xfs_fs_dirty_inode,
13081279
.drop_inode = xfs_fs_drop_inode,
13091280
.evict_inode = xfs_fs_evict_inode,
13101281
.put_super = xfs_fs_put_super,

0 commit comments

Comments
 (0)