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

ext2: 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-39-jlayton@kernel.org>
Signed-off-by: Christian Brauner <brauner@kernel.org>

authored by

Jeff Layton and committed by
Christian Brauner
fc4eed64 f29f1908

+18 -18
+1 -1
fs/ext2/acl.c
··· 237 237 error = __ext2_set_acl(inode, acl, type); 238 238 if (!error && update_mode) { 239 239 inode->i_mode = mode; 240 - inode->i_ctime = current_time(inode); 240 + inode_set_ctime_current(inode); 241 241 mark_inode_dirty(inode); 242 242 } 243 243 return error;
+3 -3
fs/ext2/dir.c
··· 468 468 ext2_set_de_type(de, inode); 469 469 ext2_commit_chunk(page, pos, len); 470 470 if (update_times) 471 - dir->i_mtime = dir->i_ctime = current_time(dir); 471 + dir->i_mtime = inode_set_ctime_current(dir); 472 472 EXT2_I(dir)->i_flags &= ~EXT2_BTREE_FL; 473 473 mark_inode_dirty(dir); 474 474 return ext2_handle_dirsync(dir); ··· 555 555 de->inode = cpu_to_le32(inode->i_ino); 556 556 ext2_set_de_type (de, inode); 557 557 ext2_commit_chunk(page, pos, rec_len); 558 - dir->i_mtime = dir->i_ctime = current_time(dir); 558 + dir->i_mtime = inode_set_ctime_current(dir); 559 559 EXT2_I(dir)->i_flags &= ~EXT2_BTREE_FL; 560 560 mark_inode_dirty(dir); 561 561 err = ext2_handle_dirsync(dir); ··· 606 606 pde->rec_len = ext2_rec_len_to_disk(to - from); 607 607 dir->inode = 0; 608 608 ext2_commit_chunk(page, pos, to - from); 609 - inode->i_ctime = inode->i_mtime = current_time(inode); 609 + inode->i_mtime = inode_set_ctime_current(inode); 610 610 EXT2_I(inode)->i_flags &= ~EXT2_BTREE_FL; 611 611 mark_inode_dirty(inode); 612 612 return ext2_handle_dirsync(inode);
+1 -1
fs/ext2/ialloc.c
··· 549 549 550 550 inode->i_ino = ino; 551 551 inode->i_blocks = 0; 552 - inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode); 552 + inode->i_mtime = inode->i_atime = inode_set_ctime_current(inode); 553 553 memset(ei->i_data, 0, sizeof(ei->i_data)); 554 554 ei->i_flags = 555 555 ext2_mask_flags(mode, EXT2_I(dir)->i_flags & EXT2_FL_INHERITED);
+5 -5
fs/ext2/inode.c
··· 595 595 if (where->bh) 596 596 mark_buffer_dirty_inode(where->bh, inode); 597 597 598 - inode->i_ctime = current_time(inode); 598 + inode_set_ctime_current(inode); 599 599 mark_inode_dirty(inode); 600 600 } 601 601 ··· 1287 1287 __ext2_truncate_blocks(inode, newsize); 1288 1288 filemap_invalidate_unlock(inode->i_mapping); 1289 1289 1290 - inode->i_mtime = inode->i_ctime = current_time(inode); 1290 + inode->i_mtime = inode_set_ctime_current(inode); 1291 1291 if (inode_needs_sync(inode)) { 1292 1292 sync_mapping_buffers(inode->i_mapping); 1293 1293 sync_inode_metadata(inode, 1); ··· 1409 1409 set_nlink(inode, le16_to_cpu(raw_inode->i_links_count)); 1410 1410 inode->i_size = le32_to_cpu(raw_inode->i_size); 1411 1411 inode->i_atime.tv_sec = (signed)le32_to_cpu(raw_inode->i_atime); 1412 - inode->i_ctime.tv_sec = (signed)le32_to_cpu(raw_inode->i_ctime); 1412 + inode_set_ctime(inode, (signed)le32_to_cpu(raw_inode->i_ctime), 0); 1413 1413 inode->i_mtime.tv_sec = (signed)le32_to_cpu(raw_inode->i_mtime); 1414 - inode->i_atime.tv_nsec = inode->i_mtime.tv_nsec = inode->i_ctime.tv_nsec = 0; 1414 + inode->i_atime.tv_nsec = inode->i_mtime.tv_nsec = 0; 1415 1415 ei->i_dtime = le32_to_cpu(raw_inode->i_dtime); 1416 1416 /* We now have enough fields to check if the inode was active or not. 1417 1417 * This is needed because nfsd might try to access dead inodes ··· 1541 1541 raw_inode->i_links_count = cpu_to_le16(inode->i_nlink); 1542 1542 raw_inode->i_size = cpu_to_le32(inode->i_size); 1543 1543 raw_inode->i_atime = cpu_to_le32(inode->i_atime.tv_sec); 1544 - raw_inode->i_ctime = cpu_to_le32(inode->i_ctime.tv_sec); 1544 + raw_inode->i_ctime = cpu_to_le32(inode_get_ctime(inode).tv_sec); 1545 1545 raw_inode->i_mtime = cpu_to_le32(inode->i_mtime.tv_sec); 1546 1546 1547 1547 raw_inode->i_blocks = cpu_to_le32(inode->i_blocks);
+2 -2
fs/ext2/ioctl.c
··· 44 44 (fa->flags & EXT2_FL_USER_MODIFIABLE); 45 45 46 46 ext2_set_inode_flags(inode); 47 - inode->i_ctime = current_time(inode); 47 + inode_set_ctime_current(inode); 48 48 mark_inode_dirty(inode); 49 49 50 50 return 0; ··· 77 77 } 78 78 79 79 inode_lock(inode); 80 - inode->i_ctime = current_time(inode); 80 + inode_set_ctime_current(inode); 81 81 inode->i_generation = generation; 82 82 inode_unlock(inode); 83 83
+4 -4
fs/ext2/namei.c
··· 211 211 if (err) 212 212 return err; 213 213 214 - inode->i_ctime = current_time(inode); 214 + inode_set_ctime_current(inode); 215 215 inode_inc_link_count(inode); 216 216 ihold(inode); 217 217 ··· 291 291 if (err) 292 292 goto out; 293 293 294 - inode->i_ctime = dir->i_ctime; 294 + inode_set_ctime_to_ts(inode, inode_get_ctime(dir)); 295 295 inode_dec_link_count(inode); 296 296 err = 0; 297 297 out: ··· 367 367 ext2_put_page(new_page, new_de); 368 368 if (err) 369 369 goto out_dir; 370 - new_inode->i_ctime = current_time(new_inode); 370 + inode_set_ctime_current(new_inode); 371 371 if (dir_de) 372 372 drop_nlink(new_inode); 373 373 inode_dec_link_count(new_inode); ··· 383 383 * Like most other Unix systems, set the ctime for inodes on a 384 384 * rename. 385 385 */ 386 - old_inode->i_ctime = current_time(old_inode); 386 + inode_set_ctime_current(old_inode); 387 387 mark_inode_dirty(old_inode); 388 388 389 389 err = ext2_delete_entry(old_de, old_page);
+1 -1
fs/ext2/super.c
··· 1572 1572 if (inode->i_size < off+len-towrite) 1573 1573 i_size_write(inode, off+len-towrite); 1574 1574 inode_inc_iversion(inode); 1575 - inode->i_mtime = inode->i_ctime = current_time(inode); 1575 + inode->i_mtime = inode_set_ctime_current(inode); 1576 1576 mark_inode_dirty(inode); 1577 1577 return len - towrite; 1578 1578 }
+1 -1
fs/ext2/xattr.c
··· 773 773 774 774 /* Update the inode. */ 775 775 EXT2_I(inode)->i_file_acl = new_bh ? new_bh->b_blocknr : 0; 776 - inode->i_ctime = current_time(inode); 776 + inode_set_ctime_current(inode); 777 777 if (IS_SYNC(inode)) { 778 778 error = sync_inode_metadata(inode, 1); 779 779 /* In case sync failed due to ENOSPC the inode was actually