@@ -4852,9 +4852,8 @@ struct inode *__ext4_iget(struct super_block *sb, unsigned long ino,
48524852 return ERR_PTR (ret );
48534853}
48544854
4855- static int ext4_inode_blocks_set (handle_t * handle ,
4856- struct ext4_inode * raw_inode ,
4857- struct ext4_inode_info * ei )
4855+ static int ext4_inode_blocks_set (struct ext4_inode * raw_inode ,
4856+ struct ext4_inode_info * ei )
48584857{
48594858 struct inode * inode = & (ei -> vfs_inode );
48604859 u64 i_blocks = READ_ONCE (inode -> i_blocks );
@@ -4957,37 +4956,16 @@ static void ext4_update_other_inodes_time(struct super_block *sb,
49574956 rcu_read_unlock ();
49584957}
49594958
4960- /*
4961- * Post the struct inode info into an on-disk inode location in the
4962- * buffer-cache. This gobbles the caller's reference to the
4963- * buffer_head in the inode location struct.
4964- *
4965- * The caller must have write access to iloc->bh.
4966- */
4967- static int ext4_do_update_inode (handle_t * handle ,
4968- struct inode * inode ,
4969- struct ext4_iloc * iloc )
4959+ static int ext4_fill_raw_inode (struct inode * inode , struct ext4_inode * raw_inode )
49704960{
4971- struct ext4_inode * raw_inode = ext4_raw_inode (iloc );
49724961 struct ext4_inode_info * ei = EXT4_I (inode );
4973- struct buffer_head * bh = iloc -> bh ;
4974- struct super_block * sb = inode -> i_sb ;
4975- int err = 0 , block ;
4976- int need_datasync = 0 , set_large_file = 0 ;
49774962 uid_t i_uid ;
49784963 gid_t i_gid ;
49794964 projid_t i_projid ;
4965+ int block ;
4966+ int err ;
49804967
4981- spin_lock (& ei -> i_raw_lock );
4982-
4983- /*
4984- * For fields not tracked in the in-memory inode, initialise them
4985- * to zero for new inodes.
4986- */
4987- if (ext4_test_inode_state (inode , EXT4_STATE_NEW ))
4988- memset (raw_inode , 0 , EXT4_SB (inode -> i_sb )-> s_inode_size );
4989-
4990- err = ext4_inode_blocks_set (handle , raw_inode , ei );
4968+ err = ext4_inode_blocks_set (raw_inode , ei );
49914969
49924970 raw_inode -> i_mode = cpu_to_le16 (inode -> i_mode );
49934971 i_uid = i_uid_read (inode );
@@ -5029,16 +5007,8 @@ static int ext4_do_update_inode(handle_t *handle,
50295007 raw_inode -> i_file_acl_high =
50305008 cpu_to_le16 (ei -> i_file_acl >> 32 );
50315009 raw_inode -> i_file_acl_lo = cpu_to_le32 (ei -> i_file_acl );
5032- if (READ_ONCE (ei -> i_disksize ) != ext4_isize (inode -> i_sb , raw_inode )) {
5033- ext4_isize_set (raw_inode , ei -> i_disksize );
5034- need_datasync = 1 ;
5035- }
5036- if (ei -> i_disksize > 0x7fffffffULL ) {
5037- if (!ext4_has_feature_large_file (sb ) ||
5038- EXT4_SB (sb )-> s_es -> s_rev_level ==
5039- cpu_to_le32 (EXT4_GOOD_OLD_REV ))
5040- set_large_file = 1 ;
5041- }
5010+ ext4_isize_set (raw_inode , ei -> i_disksize );
5011+
50425012 raw_inode -> i_generation = cpu_to_le32 (inode -> i_generation );
50435013 if (S_ISCHR (inode -> i_mode ) || S_ISBLK (inode -> i_mode )) {
50445014 if (old_valid_dev (inode -> i_rdev )) {
@@ -5078,6 +5048,45 @@ static int ext4_do_update_inode(handle_t *handle,
50785048 raw_inode -> i_projid = cpu_to_le32 (i_projid );
50795049
50805050 ext4_inode_csum_set (inode , raw_inode , ei );
5051+ return err ;
5052+ }
5053+
5054+ /*
5055+ * Post the struct inode info into an on-disk inode location in the
5056+ * buffer-cache. This gobbles the caller's reference to the
5057+ * buffer_head in the inode location struct.
5058+ *
5059+ * The caller must have write access to iloc->bh.
5060+ */
5061+ static int ext4_do_update_inode (handle_t * handle ,
5062+ struct inode * inode ,
5063+ struct ext4_iloc * iloc )
5064+ {
5065+ struct ext4_inode * raw_inode = ext4_raw_inode (iloc );
5066+ struct ext4_inode_info * ei = EXT4_I (inode );
5067+ struct buffer_head * bh = iloc -> bh ;
5068+ struct super_block * sb = inode -> i_sb ;
5069+ int err ;
5070+ int need_datasync = 0 , set_large_file = 0 ;
5071+
5072+ spin_lock (& ei -> i_raw_lock );
5073+
5074+ /*
5075+ * For fields not tracked in the in-memory inode, initialise them
5076+ * to zero for new inodes.
5077+ */
5078+ if (ext4_test_inode_state (inode , EXT4_STATE_NEW ))
5079+ memset (raw_inode , 0 , EXT4_SB (inode -> i_sb )-> s_inode_size );
5080+
5081+ if (READ_ONCE (ei -> i_disksize ) != ext4_isize (inode -> i_sb , raw_inode ))
5082+ need_datasync = 1 ;
5083+ if (ei -> i_disksize > 0x7fffffffULL ) {
5084+ if (!ext4_has_feature_large_file (sb ) ||
5085+ EXT4_SB (sb )-> s_es -> s_rev_level == cpu_to_le32 (EXT4_GOOD_OLD_REV ))
5086+ set_large_file = 1 ;
5087+ }
5088+
5089+ err = ext4_fill_raw_inode (inode , raw_inode );
50815090 spin_unlock (& ei -> i_raw_lock );
50825091 if (err ) {
50835092 EXT4_ERROR_INODE (inode , "corrupted inode contents" );
0 commit comments