Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

gfs2: convert to ctime accessor functions

In later patches, we're going to change how the inode's ctime field is
used. Switch to using accessor functions instead of raw accesses of
inode->i_ctime.

Signed-off-by: Jeff Layton <jlayton@kernel.org>
Reviewed-by: Jan Kara <jack@suse.cz>
Message-Id: <20230705190309.579783-45-jlayton@kernel.org>
Signed-off-by: Christian Brauner <brauner@kernel.org>

authored by

Jeff Layton and committed by
Christian Brauner
8a8b8d91 ceb2d5e9

+27 -27
+1 -1
fs/gfs2/acl.c
··· 142 142 143 143 ret = __gfs2_set_acl(inode, acl, type); 144 144 if (!ret && mode != inode->i_mode) { 145 - inode->i_ctime = current_time(inode); 145 + inode_set_ctime_current(inode); 146 146 inode->i_mode = mode; 147 147 mark_inode_dirty(inode); 148 148 }
+5 -6
fs/gfs2/bmap.c
··· 1386 1386 ip->i_diskflags |= GFS2_DIF_TRUNC_IN_PROG; 1387 1387 1388 1388 i_size_write(inode, newsize); 1389 - ip->i_inode.i_mtime = ip->i_inode.i_ctime = current_time(&ip->i_inode); 1389 + ip->i_inode.i_mtime = inode_set_ctime_current(&ip->i_inode); 1390 1390 gfs2_dinode_out(ip, dibh->b_data); 1391 1391 1392 1392 if (journaled) ··· 1583 1583 1584 1584 /* Every transaction boundary, we rewrite the dinode 1585 1585 to keep its di_blocks current in case of failure. */ 1586 - ip->i_inode.i_mtime = ip->i_inode.i_ctime = 1587 - current_time(&ip->i_inode); 1586 + ip->i_inode.i_mtime = inode_set_ctime_current(&ip->i_inode); 1588 1587 gfs2_trans_add_meta(ip->i_gl, dibh); 1589 1588 gfs2_dinode_out(ip, dibh->b_data); 1590 1589 brelse(dibh); ··· 1949 1950 gfs2_statfs_change(sdp, 0, +btotal, 0); 1950 1951 gfs2_quota_change(ip, -(s64)btotal, ip->i_inode.i_uid, 1951 1952 ip->i_inode.i_gid); 1952 - ip->i_inode.i_mtime = ip->i_inode.i_ctime = current_time(&ip->i_inode); 1953 + ip->i_inode.i_mtime = inode_set_ctime_current(&ip->i_inode); 1953 1954 gfs2_trans_add_meta(ip->i_gl, dibh); 1954 1955 gfs2_dinode_out(ip, dibh->b_data); 1955 1956 up_write(&ip->i_rw_mutex); ··· 1992 1993 gfs2_buffer_clear_tail(dibh, sizeof(struct gfs2_dinode)); 1993 1994 gfs2_ordered_del_inode(ip); 1994 1995 } 1995 - ip->i_inode.i_mtime = ip->i_inode.i_ctime = current_time(&ip->i_inode); 1996 + ip->i_inode.i_mtime = inode_set_ctime_current(&ip->i_inode); 1996 1997 ip->i_diskflags &= ~GFS2_DIF_TRUNC_IN_PROG; 1997 1998 1998 1999 gfs2_trans_add_meta(ip->i_gl, dibh); ··· 2093 2094 goto do_end_trans; 2094 2095 2095 2096 truncate_setsize(inode, size); 2096 - ip->i_inode.i_mtime = ip->i_inode.i_ctime = current_time(&ip->i_inode); 2097 + ip->i_inode.i_mtime = inode_set_ctime_current(&ip->i_inode); 2097 2098 gfs2_trans_add_meta(ip->i_gl, dibh); 2098 2099 gfs2_dinode_out(ip, dibh->b_data); 2099 2100 brelse(dibh);
+8 -7
fs/gfs2/dir.c
··· 130 130 memcpy(dibh->b_data + offset + sizeof(struct gfs2_dinode), buf, size); 131 131 if (ip->i_inode.i_size < offset + size) 132 132 i_size_write(&ip->i_inode, offset + size); 133 - ip->i_inode.i_mtime = ip->i_inode.i_ctime = current_time(&ip->i_inode); 133 + ip->i_inode.i_mtime = inode_set_ctime_current(&ip->i_inode); 134 134 gfs2_dinode_out(ip, dibh->b_data); 135 135 136 136 brelse(dibh); ··· 227 227 228 228 if (ip->i_inode.i_size < offset + copied) 229 229 i_size_write(&ip->i_inode, offset + copied); 230 - ip->i_inode.i_mtime = ip->i_inode.i_ctime = current_time(&ip->i_inode); 230 + ip->i_inode.i_mtime = inode_set_ctime_current(&ip->i_inode); 231 231 232 232 gfs2_trans_add_meta(ip->i_gl, dibh); 233 233 gfs2_dinode_out(ip, dibh->b_data); ··· 1814 1814 gfs2_inum_out(nip, dent); 1815 1815 dent->de_type = cpu_to_be16(IF2DT(nip->i_inode.i_mode)); 1816 1816 dent->de_rahead = cpu_to_be16(gfs2_inode_ra_len(nip)); 1817 - tv = current_time(&ip->i_inode); 1817 + tv = inode_set_ctime_current(&ip->i_inode); 1818 1818 if (ip->i_diskflags & GFS2_DIF_EXHASH) { 1819 1819 leaf = (struct gfs2_leaf *)bh->b_data; 1820 1820 be16_add_cpu(&leaf->lf_entries, 1); ··· 1825 1825 da->bh = NULL; 1826 1826 brelse(bh); 1827 1827 ip->i_entries++; 1828 - ip->i_inode.i_mtime = ip->i_inode.i_ctime = tv; 1828 + ip->i_inode.i_mtime = tv; 1829 1829 if (S_ISDIR(nip->i_inode.i_mode)) 1830 1830 inc_nlink(&ip->i_inode); 1831 1831 mark_inode_dirty(inode); ··· 1876 1876 const struct qstr *name = &dentry->d_name; 1877 1877 struct gfs2_dirent *dent, *prev = NULL; 1878 1878 struct buffer_head *bh; 1879 - struct timespec64 tv = current_time(&dip->i_inode); 1879 + struct timespec64 tv; 1880 1880 1881 1881 /* Returns _either_ the entry (if its first in block) or the 1882 1882 previous entry otherwise */ ··· 1896 1896 } 1897 1897 1898 1898 dirent_del(dip, bh, prev, dent); 1899 + tv = inode_set_ctime_current(&dip->i_inode); 1899 1900 if (dip->i_diskflags & GFS2_DIF_EXHASH) { 1900 1901 struct gfs2_leaf *leaf = (struct gfs2_leaf *)bh->b_data; 1901 1902 u16 entries = be16_to_cpu(leaf->lf_entries); ··· 1911 1910 if (!dip->i_entries) 1912 1911 gfs2_consist_inode(dip); 1913 1912 dip->i_entries--; 1914 - dip->i_inode.i_mtime = dip->i_inode.i_ctime = tv; 1913 + dip->i_inode.i_mtime = tv; 1915 1914 if (d_is_dir(dentry)) 1916 1915 drop_nlink(&dip->i_inode); 1917 1916 mark_inode_dirty(&dip->i_inode); ··· 1952 1951 dent->de_type = cpu_to_be16(new_type); 1953 1952 brelse(bh); 1954 1953 1955 - dip->i_inode.i_mtime = dip->i_inode.i_ctime = current_time(&dip->i_inode); 1954 + dip->i_inode.i_mtime = inode_set_ctime_current(&dip->i_inode); 1956 1955 mark_inode_dirty_sync(&dip->i_inode); 1957 1956 return 0; 1958 1957 }
+1 -1
fs/gfs2/file.c
··· 260 260 error = gfs2_meta_inode_buffer(ip, &bh); 261 261 if (error) 262 262 goto out_trans_end; 263 - inode->i_ctime = current_time(inode); 263 + inode_set_ctime_current(inode); 264 264 gfs2_trans_add_meta(ip->i_gl, bh); 265 265 ip->i_diskflags = new_flags; 266 266 gfs2_dinode_out(ip, bh->b_data);
+2 -2
fs/gfs2/glops.c
··· 437 437 inode->i_atime = atime; 438 438 inode->i_mtime.tv_sec = be64_to_cpu(str->di_mtime); 439 439 inode->i_mtime.tv_nsec = be32_to_cpu(str->di_mtime_nsec); 440 - inode->i_ctime.tv_sec = be64_to_cpu(str->di_ctime); 441 - inode->i_ctime.tv_nsec = be32_to_cpu(str->di_ctime_nsec); 440 + inode_set_ctime(inode, be64_to_cpu(str->di_ctime), 441 + be32_to_cpu(str->di_ctime_nsec)); 442 442 443 443 ip->i_goal = be64_to_cpu(str->di_goal_meta); 444 444 ip->i_generation = be64_to_cpu(str->di_generation);
+4 -4
fs/gfs2/inode.c
··· 690 690 set_nlink(inode, S_ISDIR(mode) ? 2 : 1); 691 691 inode->i_rdev = dev; 692 692 inode->i_size = size; 693 - inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode); 693 + inode->i_atime = inode->i_mtime = inode_set_ctime_current(inode); 694 694 munge_mode_uid_gid(dip, inode); 695 695 check_and_update_goal(dip); 696 696 ip->i_goal = dip->i_goal; ··· 1029 1029 1030 1030 gfs2_trans_add_meta(ip->i_gl, dibh); 1031 1031 inc_nlink(&ip->i_inode); 1032 - ip->i_inode.i_ctime = current_time(&ip->i_inode); 1032 + inode_set_ctime_current(&ip->i_inode); 1033 1033 ihold(inode); 1034 1034 d_instantiate(dentry, inode); 1035 1035 mark_inode_dirty(inode); ··· 1114 1114 return error; 1115 1115 1116 1116 ip->i_entries = 0; 1117 - inode->i_ctime = current_time(inode); 1117 + inode_set_ctime_current(inode); 1118 1118 if (S_ISDIR(inode->i_mode)) 1119 1119 clear_nlink(inode); 1120 1120 else ··· 1371 1371 if (dir_rename) 1372 1372 return gfs2_dir_mvino(ip, &gfs2_qdotdot, ndip, DT_DIR); 1373 1373 1374 - ip->i_inode.i_ctime = current_time(&ip->i_inode); 1374 + inode_set_ctime_current(&ip->i_inode); 1375 1375 mark_inode_dirty_sync(&ip->i_inode); 1376 1376 return 0; 1377 1377 }
+2 -2
fs/gfs2/super.c
··· 412 412 str->di_blocks = cpu_to_be64(gfs2_get_inode_blocks(inode)); 413 413 str->di_atime = cpu_to_be64(inode->i_atime.tv_sec); 414 414 str->di_mtime = cpu_to_be64(inode->i_mtime.tv_sec); 415 - str->di_ctime = cpu_to_be64(inode->i_ctime.tv_sec); 415 + str->di_ctime = cpu_to_be64(inode_get_ctime(inode).tv_sec); 416 416 417 417 str->di_goal_meta = cpu_to_be64(ip->i_goal); 418 418 str->di_goal_data = cpu_to_be64(ip->i_goal); ··· 429 429 str->di_eattr = cpu_to_be64(ip->i_eattr); 430 430 str->di_atime_nsec = cpu_to_be32(inode->i_atime.tv_nsec); 431 431 str->di_mtime_nsec = cpu_to_be32(inode->i_mtime.tv_nsec); 432 - str->di_ctime_nsec = cpu_to_be32(inode->i_ctime.tv_nsec); 432 + str->di_ctime_nsec = cpu_to_be32(inode_get_ctime(inode).tv_nsec); 433 433 } 434 434 435 435 /**
+4 -4
fs/gfs2/xattr.c
··· 311 311 ea->ea_num_ptrs = 0; 312 312 } 313 313 314 - ip->i_inode.i_ctime = current_time(&ip->i_inode); 314 + inode_set_ctime_current(&ip->i_inode); 315 315 __mark_inode_dirty(&ip->i_inode, I_DIRTY_DATASYNC); 316 316 317 317 gfs2_trans_end(sdp); ··· 763 763 if (error) 764 764 goto out_end_trans; 765 765 766 - ip->i_inode.i_ctime = current_time(&ip->i_inode); 766 + inode_set_ctime_current(&ip->i_inode); 767 767 __mark_inode_dirty(&ip->i_inode, I_DIRTY_DATASYNC); 768 768 769 769 out_end_trans: ··· 888 888 if (es->es_el) 889 889 ea_set_remove_stuffed(ip, es->es_el); 890 890 891 - ip->i_inode.i_ctime = current_time(&ip->i_inode); 891 + inode_set_ctime_current(&ip->i_inode); 892 892 __mark_inode_dirty(&ip->i_inode, I_DIRTY_DATASYNC); 893 893 894 894 gfs2_trans_end(GFS2_SB(&ip->i_inode)); ··· 1106 1106 ea->ea_type = GFS2_EATYPE_UNUSED; 1107 1107 } 1108 1108 1109 - ip->i_inode.i_ctime = current_time(&ip->i_inode); 1109 + inode_set_ctime_current(&ip->i_inode); 1110 1110 __mark_inode_dirty(&ip->i_inode, I_DIRTY_DATASYNC); 1111 1111 1112 1112 gfs2_trans_end(GFS2_SB(&ip->i_inode));