@@ -1101,8 +1101,7 @@ static noinline int backref_in_log(struct btrfs_root *log,
11011101static int unlink_refs_not_in_log (struct walk_control * wc ,
11021102 struct btrfs_key * search_key ,
11031103 struct btrfs_inode * dir ,
1104- struct btrfs_inode * inode ,
1105- u64 parent_objectid )
1104+ struct btrfs_inode * inode )
11061105{
11071106 struct extent_buffer * leaf = wc -> subvol_path -> nodes [0 ];
11081107 unsigned long ptr ;
@@ -1130,7 +1129,7 @@ static int unlink_refs_not_in_log(struct walk_control *wc,
11301129 return ret ;
11311130 }
11321131
1133- ret = backref_in_log (wc -> log , search_key , parent_objectid , & victim_name );
1132+ ret = backref_in_log (wc -> log , search_key , btrfs_ino ( dir ) , & victim_name );
11341133 if (ret ) {
11351134 kfree (victim_name .name );
11361135 if (ret < 0 ) {
@@ -1156,9 +1155,8 @@ static int unlink_refs_not_in_log(struct walk_control *wc,
11561155
11571156static int unlink_extrefs_not_in_log (struct walk_control * wc ,
11581157 struct btrfs_key * search_key ,
1159- struct btrfs_inode * inode ,
1160- u64 inode_objectid ,
1161- u64 parent_objectid )
1158+ struct btrfs_inode * dir ,
1159+ struct btrfs_inode * inode )
11621160{
11631161 struct extent_buffer * leaf = wc -> subvol_path -> nodes [0 ];
11641162 const unsigned long base = btrfs_item_ptr_offset (leaf , wc -> subvol_path -> slots [0 ]);
@@ -1177,7 +1175,7 @@ static int unlink_extrefs_not_in_log(struct walk_control *wc,
11771175 extref = (struct btrfs_inode_extref * )(base + cur_offset );
11781176 victim_name .len = btrfs_inode_extref_name_len (leaf , extref );
11791177
1180- if (btrfs_inode_extref_parent (leaf , extref ) != parent_objectid )
1178+ if (btrfs_inode_extref_parent (leaf , extref ) != btrfs_ino ( dir ) )
11811179 goto next ;
11821180
11831181 ret = read_alloc_one_name (leaf , & extref -> name , victim_name .len ,
@@ -1187,12 +1185,12 @@ static int unlink_extrefs_not_in_log(struct walk_control *wc,
11871185 return ret ;
11881186 }
11891187
1190- search_key -> objectid = inode_objectid ;
1188+ search_key -> objectid = btrfs_ino ( inode ) ;
11911189 search_key -> type = BTRFS_INODE_EXTREF_KEY ;
1192- search_key -> offset = btrfs_extref_hash (parent_objectid ,
1190+ search_key -> offset = btrfs_extref_hash (btrfs_ino ( dir ) ,
11931191 victim_name .name ,
11941192 victim_name .len );
1195- ret = backref_in_log (log_root , search_key , parent_objectid , & victim_name );
1193+ ret = backref_in_log (log_root , search_key , btrfs_ino ( dir ) , & victim_name );
11961194 if (ret ) {
11971195 kfree (victim_name .name );
11981196 if (ret < 0 ) {
@@ -1204,7 +1202,7 @@ static int unlink_extrefs_not_in_log(struct walk_control *wc,
12041202 continue ;
12051203 }
12061204
1207- victim_parent = btrfs_iget_logging (parent_objectid , root );
1205+ victim_parent = btrfs_iget_logging (btrfs_ino ( dir ) , root );
12081206 if (IS_ERR (victim_parent )) {
12091207 kfree (victim_name .name );
12101208 ret = PTR_ERR (victim_parent );
@@ -1230,7 +1228,6 @@ static int unlink_extrefs_not_in_log(struct walk_control *wc,
12301228static inline int __add_inode_ref (struct walk_control * wc ,
12311229 struct btrfs_inode * dir ,
12321230 struct btrfs_inode * inode ,
1233- u64 inode_objectid , u64 parent_objectid ,
12341231 u64 ref_index , struct fscrypt_str * name )
12351232{
12361233 int ret ;
@@ -1242,9 +1239,9 @@ static inline int __add_inode_ref(struct walk_control *wc,
12421239
12431240again :
12441241 /* Search old style refs */
1245- search_key .objectid = inode_objectid ;
1242+ search_key .objectid = btrfs_ino ( inode ) ;
12461243 search_key .type = BTRFS_INODE_REF_KEY ;
1247- search_key .offset = parent_objectid ;
1244+ search_key .offset = btrfs_ino ( dir ) ;
12481245 ret = btrfs_search_slot (NULL , root , & search_key , wc -> subvol_path , 0 , 0 );
12491246 if (ret < 0 ) {
12501247 btrfs_abort_transaction (trans , ret );
@@ -1257,8 +1254,7 @@ static inline int __add_inode_ref(struct walk_control *wc,
12571254 if (search_key .objectid == search_key .offset )
12581255 return 1 ;
12591256
1260- ret = unlink_refs_not_in_log (wc , & search_key , dir , inode ,
1261- parent_objectid );
1257+ ret = unlink_refs_not_in_log (wc , & search_key , dir , inode );
12621258 if (ret == - EAGAIN )
12631259 goto again ;
12641260 else if (ret )
@@ -1268,12 +1264,11 @@ static inline int __add_inode_ref(struct walk_control *wc,
12681264
12691265 /* Same search but for extended refs */
12701266 extref = btrfs_lookup_inode_extref (root , wc -> subvol_path , name ,
1271- inode_objectid , parent_objectid );
1267+ btrfs_ino ( inode ), btrfs_ino ( dir ) );
12721268 if (IS_ERR (extref )) {
12731269 return PTR_ERR (extref );
12741270 } else if (extref ) {
1275- ret = unlink_extrefs_not_in_log (wc , & search_key , inode ,
1276- inode_objectid , parent_objectid );
1271+ ret = unlink_extrefs_not_in_log (wc , & search_key , dir , inode );
12771272 if (ret == - EAGAIN )
12781273 goto again ;
12791274 else if (ret )
@@ -1559,8 +1554,7 @@ static noinline int add_inode_ref(struct walk_control *wc)
15591554 * overwrite any existing back reference, and we don't
15601555 * want to create dangling pointers in the directory.
15611556 */
1562- ret = __add_inode_ref (wc , dir , inode , inode_objectid ,
1563- parent_objectid , ref_index , & name );
1557+ ret = __add_inode_ref (wc , dir , inode , ref_index , & name );
15641558 if (ret ) {
15651559 if (ret == 1 )
15661560 ret = 0 ;
0 commit comments