@@ -355,7 +355,7 @@ static int cachefiles_bury_object(struct cachefiles_cache *cache,
355
355
return - EIO ;
356
356
}
357
357
358
- if (grave -> d_inode ) {
358
+ if (d_is_positive ( grave ) ) {
359
359
unlock_rename (cache -> graveyard , dir );
360
360
dput (grave );
361
361
grave = NULL ;
@@ -415,7 +415,7 @@ int cachefiles_delete_object(struct cachefiles_cache *cache,
415
415
_enter (",OBJ%x{%p}" , object -> fscache .debug_id , object -> dentry );
416
416
417
417
ASSERT (object -> dentry );
418
- ASSERT (object -> dentry -> d_inode );
418
+ ASSERT (d_backing_inode ( object -> dentry ) );
419
419
ASSERT (object -> dentry -> d_parent );
420
420
421
421
dir = dget_parent (object -> dentry );
@@ -473,7 +473,7 @@ int cachefiles_walk_to_object(struct cachefiles_object *parent,
473
473
path .mnt = cache -> mnt ;
474
474
475
475
ASSERT (parent -> dentry );
476
- ASSERT (parent -> dentry -> d_inode );
476
+ ASSERT (d_backing_inode ( parent -> dentry ) );
477
477
478
478
if (!(d_is_dir (parent -> dentry ))) {
479
479
// TODO: convert file to dir
@@ -505,21 +505,21 @@ int cachefiles_walk_to_object(struct cachefiles_object *parent,
505
505
if (IS_ERR (next ))
506
506
goto lookup_error ;
507
507
508
- _debug ("next -> %p %s" , next , next -> d_inode ? "positive" : "negative" );
508
+ _debug ("next -> %p %s" , next , d_backing_inode ( next ) ? "positive" : "negative" );
509
509
510
510
if (!key )
511
- object -> new = !next -> d_inode ;
511
+ object -> new = !d_backing_inode ( next ) ;
512
512
513
513
/* if this element of the path doesn't exist, then the lookup phase
514
514
* failed, and we can release any readers in the certain knowledge that
515
515
* there's nothing for them to actually read */
516
- if (! next -> d_inode )
516
+ if (d_is_negative ( next ) )
517
517
fscache_object_lookup_negative (& object -> fscache );
518
518
519
519
/* we need to create the object if it's negative */
520
520
if (key || object -> type == FSCACHE_COOKIE_TYPE_INDEX ) {
521
521
/* index objects and intervening tree levels must be subdirs */
522
- if (! next -> d_inode ) {
522
+ if (d_is_negative ( next ) ) {
523
523
ret = cachefiles_has_space (cache , 1 , 0 );
524
524
if (ret < 0 )
525
525
goto create_error ;
@@ -534,21 +534,21 @@ int cachefiles_walk_to_object(struct cachefiles_object *parent,
534
534
if (ret < 0 )
535
535
goto create_error ;
536
536
537
- ASSERT (next -> d_inode );
537
+ ASSERT (d_backing_inode ( next ) );
538
538
539
539
_debug ("mkdir -> %p{%p{ino=%lu}}" ,
540
- next , next -> d_inode , next -> d_inode -> i_ino );
540
+ next , d_backing_inode ( next ), d_backing_inode ( next ) -> i_ino );
541
541
542
542
} else if (!d_can_lookup (next )) {
543
543
pr_err ("inode %lu is not a directory\n" ,
544
- next -> d_inode -> i_ino );
544
+ d_backing_inode ( next ) -> i_ino );
545
545
ret = - ENOBUFS ;
546
546
goto error ;
547
547
}
548
548
549
549
} else {
550
550
/* non-index objects start out life as files */
551
- if (! next -> d_inode ) {
551
+ if (d_is_negative ( next ) ) {
552
552
ret = cachefiles_has_space (cache , 1 , 0 );
553
553
if (ret < 0 )
554
554
goto create_error ;
@@ -563,16 +563,16 @@ int cachefiles_walk_to_object(struct cachefiles_object *parent,
563
563
if (ret < 0 )
564
564
goto create_error ;
565
565
566
- ASSERT (next -> d_inode );
566
+ ASSERT (d_backing_inode ( next ) );
567
567
568
568
_debug ("create -> %p{%p{ino=%lu}}" ,
569
- next , next -> d_inode , next -> d_inode -> i_ino );
569
+ next , d_backing_inode ( next ), d_backing_inode ( next ) -> i_ino );
570
570
571
571
} else if (!d_can_lookup (next ) &&
572
572
!d_is_reg (next )
573
573
) {
574
574
pr_err ("inode %lu is not a file or directory\n" ,
575
- next -> d_inode -> i_ino );
575
+ d_backing_inode ( next ) -> i_ino );
576
576
ret = - ENOBUFS ;
577
577
goto error ;
578
578
}
@@ -646,7 +646,7 @@ int cachefiles_walk_to_object(struct cachefiles_object *parent,
646
646
const struct address_space_operations * aops ;
647
647
648
648
ret = - EPERM ;
649
- aops = object -> dentry -> d_inode -> i_mapping -> a_ops ;
649
+ aops = d_backing_inode ( object -> dentry ) -> i_mapping -> a_ops ;
650
650
if (!aops -> bmap )
651
651
goto check_error ;
652
652
@@ -659,7 +659,7 @@ int cachefiles_walk_to_object(struct cachefiles_object *parent,
659
659
object -> new = 0 ;
660
660
fscache_obtained_object (& object -> fscache );
661
661
662
- _leave (" = 0 [%lu]" , object -> dentry -> d_inode -> i_ino );
662
+ _leave (" = 0 [%lu]" , d_backing_inode ( object -> dentry ) -> i_ino );
663
663
return 0 ;
664
664
665
665
create_error :
@@ -731,10 +731,10 @@ struct dentry *cachefiles_get_directory(struct cachefiles_cache *cache,
731
731
}
732
732
733
733
_debug ("subdir -> %p %s" ,
734
- subdir , subdir -> d_inode ? "positive" : "negative" );
734
+ subdir , d_backing_inode ( subdir ) ? "positive" : "negative" );
735
735
736
736
/* we need to create the subdir if it doesn't exist yet */
737
- if (! subdir -> d_inode ) {
737
+ if (d_is_negative ( subdir ) ) {
738
738
ret = cachefiles_has_space (cache , 1 , 0 );
739
739
if (ret < 0 )
740
740
goto mkdir_error ;
@@ -750,18 +750,18 @@ struct dentry *cachefiles_get_directory(struct cachefiles_cache *cache,
750
750
if (ret < 0 )
751
751
goto mkdir_error ;
752
752
753
- ASSERT (subdir -> d_inode );
753
+ ASSERT (d_backing_inode ( subdir ) );
754
754
755
755
_debug ("mkdir -> %p{%p{ino=%lu}}" ,
756
756
subdir ,
757
- subdir -> d_inode ,
758
- subdir -> d_inode -> i_ino );
757
+ d_backing_inode ( subdir ) ,
758
+ d_backing_inode ( subdir ) -> i_ino );
759
759
}
760
760
761
761
mutex_unlock (& d_inode (dir )-> i_mutex );
762
762
763
763
/* we need to make sure the subdir is a directory */
764
- ASSERT (subdir -> d_inode );
764
+ ASSERT (d_backing_inode ( subdir ) );
765
765
766
766
if (!d_can_lookup (subdir )) {
767
767
pr_err ("%s is not a directory\n" , dirname );
@@ -770,18 +770,18 @@ struct dentry *cachefiles_get_directory(struct cachefiles_cache *cache,
770
770
}
771
771
772
772
ret = - EPERM ;
773
- if (!subdir -> d_inode -> i_op -> setxattr ||
774
- !subdir -> d_inode -> i_op -> getxattr ||
775
- !subdir -> d_inode -> i_op -> lookup ||
776
- !subdir -> d_inode -> i_op -> mkdir ||
777
- !subdir -> d_inode -> i_op -> create ||
778
- (!subdir -> d_inode -> i_op -> rename &&
779
- !subdir -> d_inode -> i_op -> rename2 ) ||
780
- !subdir -> d_inode -> i_op -> rmdir ||
781
- !subdir -> d_inode -> i_op -> unlink )
773
+ if (!d_backing_inode ( subdir ) -> i_op -> setxattr ||
774
+ !d_backing_inode ( subdir ) -> i_op -> getxattr ||
775
+ !d_backing_inode ( subdir ) -> i_op -> lookup ||
776
+ !d_backing_inode ( subdir ) -> i_op -> mkdir ||
777
+ !d_backing_inode ( subdir ) -> i_op -> create ||
778
+ (!d_backing_inode ( subdir ) -> i_op -> rename &&
779
+ !d_backing_inode ( subdir ) -> i_op -> rename2 ) ||
780
+ !d_backing_inode ( subdir ) -> i_op -> rmdir ||
781
+ !d_backing_inode ( subdir ) -> i_op -> unlink )
782
782
goto check_error ;
783
783
784
- _leave (" = [%lu]" , subdir -> d_inode -> i_ino );
784
+ _leave (" = [%lu]" , d_backing_inode ( subdir ) -> i_ino );
785
785
return subdir ;
786
786
787
787
check_error :
@@ -836,12 +836,12 @@ static struct dentry *cachefiles_check_active(struct cachefiles_cache *cache,
836
836
goto lookup_error ;
837
837
838
838
//_debug("victim -> %p %s",
839
- // victim, victim->d_inode ? "positive" : "negative");
839
+ // victim, d_backing_inode( victim) ? "positive" : "negative");
840
840
841
841
/* if the object is no longer there then we probably retired the object
842
842
* at the netfs's request whilst the cull was in progress
843
843
*/
844
- if (! victim -> d_inode ) {
844
+ if (d_is_negative ( victim ) ) {
845
845
mutex_unlock (& d_inode (dir )-> i_mutex );
846
846
dput (victim );
847
847
_leave (" = -ENOENT [absent]" );
@@ -913,7 +913,7 @@ int cachefiles_cull(struct cachefiles_cache *cache, struct dentry *dir,
913
913
return PTR_ERR (victim );
914
914
915
915
_debug ("victim -> %p %s" ,
916
- victim , victim -> d_inode ? "positive" : "negative" );
916
+ victim , d_backing_inode ( victim ) ? "positive" : "negative" );
917
917
918
918
/* okay... the victim is not being used so we can cull it
919
919
* - start by marking it as stale
0 commit comments