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

ext4: reduce arguments of ext4_fc_add_dentry_tlv

Let's pass fc_dentry directly since those arguments (tag, parent_ino and
ino etc) can be deferenced from it.

Signed-off-by: Guoqing Jiang <jiangguoqing@kylinos.cn>
Reviewed-by: Harshad Shirwadkar <harshadshirwadkar@gmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Link: https://lore.kernel.org/r/20210727080708.3708814-1-guoqing.jiang@linux.dev

authored by

Guoqing Jiang and committed by
Theodore Ts'o
facec450 5036ab8d

+9 -18
+9 -18
fs/ext4/fast_commit.c
··· 775 775 } 776 776 777 777 /* Same as above, but adds dentry tlv. */ 778 - static bool ext4_fc_add_dentry_tlv(struct super_block *sb, u16 tag, 779 - int parent_ino, int ino, int dlen, 780 - const unsigned char *dname, 781 - u32 *crc) 778 + static bool ext4_fc_add_dentry_tlv(struct super_block *sb, u32 *crc, 779 + struct ext4_fc_dentry_update *fc_dentry) 782 780 { 783 781 struct ext4_fc_dentry_info fcd; 784 782 struct ext4_fc_tl tl; 783 + int dlen = fc_dentry->fcd_name.len; 785 784 u8 *dst = ext4_fc_reserve_space(sb, sizeof(tl) + sizeof(fcd) + dlen, 786 785 crc); 787 786 788 787 if (!dst) 789 788 return false; 790 789 791 - fcd.fc_parent_ino = cpu_to_le32(parent_ino); 792 - fcd.fc_ino = cpu_to_le32(ino); 793 - tl.fc_tag = cpu_to_le16(tag); 790 + fcd.fc_parent_ino = cpu_to_le32(fc_dentry->fcd_parent); 791 + fcd.fc_ino = cpu_to_le32(fc_dentry->fcd_ino); 792 + tl.fc_tag = cpu_to_le16(fc_dentry->fcd_op); 794 793 tl.fc_len = cpu_to_le16(sizeof(fcd) + dlen); 795 794 ext4_fc_memcpy(sb, dst, &tl, sizeof(tl), crc); 796 795 dst += sizeof(tl); 797 796 ext4_fc_memcpy(sb, dst, &fcd, sizeof(fcd), crc); 798 797 dst += sizeof(fcd); 799 - ext4_fc_memcpy(sb, dst, dname, dlen, crc); 798 + ext4_fc_memcpy(sb, dst, fc_dentry->fcd_name.name, dlen, crc); 800 799 dst += dlen; 801 800 802 801 return true; ··· 991 992 &sbi->s_fc_dentry_q[FC_Q_MAIN], fcd_list) { 992 993 if (fc_dentry->fcd_op != EXT4_FC_TAG_CREAT) { 993 994 spin_unlock(&sbi->s_fc_lock); 994 - if (!ext4_fc_add_dentry_tlv( 995 - sb, fc_dentry->fcd_op, 996 - fc_dentry->fcd_parent, fc_dentry->fcd_ino, 997 - fc_dentry->fcd_name.len, 998 - fc_dentry->fcd_name.name, crc)) { 995 + if (!ext4_fc_add_dentry_tlv(sb, crc, fc_dentry)) { 999 996 ret = -ENOSPC; 1000 997 goto lock_and_exit; 1001 998 } ··· 1030 1035 if (ret) 1031 1036 goto lock_and_exit; 1032 1037 1033 - if (!ext4_fc_add_dentry_tlv( 1034 - sb, fc_dentry->fcd_op, 1035 - fc_dentry->fcd_parent, fc_dentry->fcd_ino, 1036 - fc_dentry->fcd_name.len, 1037 - fc_dentry->fcd_name.name, crc)) { 1038 + if (!ext4_fc_add_dentry_tlv(sb, crc, fc_dentry)) { 1038 1039 ret = -ENOSPC; 1039 1040 goto lock_and_exit; 1040 1041 }