@@ -355,7 +355,7 @@ static int cachefiles_bury_object(struct cachefiles_cache *cache,
355355 return - EIO ;
356356 }
357357
358- if (grave -> d_inode ) {
358+ if (d_is_positive ( grave ) ) {
359359 unlock_rename (cache -> graveyard , dir );
360360 dput (grave );
361361 grave = NULL ;
@@ -415,7 +415,7 @@ int cachefiles_delete_object(struct cachefiles_cache *cache,
415415 _enter (",OBJ%x{%p}" , object -> fscache .debug_id , object -> dentry );
416416
417417 ASSERT (object -> dentry );
418- ASSERT (object -> dentry -> d_inode );
418+ ASSERT (d_backing_inode ( object -> dentry ) );
419419 ASSERT (object -> dentry -> d_parent );
420420
421421 dir = dget_parent (object -> dentry );
@@ -473,7 +473,7 @@ int cachefiles_walk_to_object(struct cachefiles_object *parent,
473473 path .mnt = cache -> mnt ;
474474
475475 ASSERT (parent -> dentry );
476- ASSERT (parent -> dentry -> d_inode );
476+ ASSERT (d_backing_inode ( parent -> dentry ) );
477477
478478 if (!(d_is_dir (parent -> dentry ))) {
479479 // TODO: convert file to dir
@@ -505,21 +505,21 @@ int cachefiles_walk_to_object(struct cachefiles_object *parent,
505505 if (IS_ERR (next ))
506506 goto lookup_error ;
507507
508- _debug ("next -> %p %s" , next , next -> d_inode ? "positive" : "negative" );
508+ _debug ("next -> %p %s" , next , d_backing_inode ( next ) ? "positive" : "negative" );
509509
510510 if (!key )
511- object -> new = !next -> d_inode ;
511+ object -> new = !d_backing_inode ( next ) ;
512512
513513 /* if this element of the path doesn't exist, then the lookup phase
514514 * failed, and we can release any readers in the certain knowledge that
515515 * there's nothing for them to actually read */
516- if (! next -> d_inode )
516+ if (d_is_negative ( next ) )
517517 fscache_object_lookup_negative (& object -> fscache );
518518
519519 /* we need to create the object if it's negative */
520520 if (key || object -> type == FSCACHE_COOKIE_TYPE_INDEX ) {
521521 /* index objects and intervening tree levels must be subdirs */
522- if (! next -> d_inode ) {
522+ if (d_is_negative ( next ) ) {
523523 ret = cachefiles_has_space (cache , 1 , 0 );
524524 if (ret < 0 )
525525 goto create_error ;
@@ -534,21 +534,21 @@ int cachefiles_walk_to_object(struct cachefiles_object *parent,
534534 if (ret < 0 )
535535 goto create_error ;
536536
537- ASSERT (next -> d_inode );
537+ ASSERT (d_backing_inode ( next ) );
538538
539539 _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 );
541541
542542 } else if (!d_can_lookup (next )) {
543543 pr_err ("inode %lu is not a directory\n" ,
544- next -> d_inode -> i_ino );
544+ d_backing_inode ( next ) -> i_ino );
545545 ret = - ENOBUFS ;
546546 goto error ;
547547 }
548548
549549 } else {
550550 /* non-index objects start out life as files */
551- if (! next -> d_inode ) {
551+ if (d_is_negative ( next ) ) {
552552 ret = cachefiles_has_space (cache , 1 , 0 );
553553 if (ret < 0 )
554554 goto create_error ;
@@ -563,16 +563,16 @@ int cachefiles_walk_to_object(struct cachefiles_object *parent,
563563 if (ret < 0 )
564564 goto create_error ;
565565
566- ASSERT (next -> d_inode );
566+ ASSERT (d_backing_inode ( next ) );
567567
568568 _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 );
570570
571571 } else if (!d_can_lookup (next ) &&
572572 !d_is_reg (next )
573573 ) {
574574 pr_err ("inode %lu is not a file or directory\n" ,
575- next -> d_inode -> i_ino );
575+ d_backing_inode ( next ) -> i_ino );
576576 ret = - ENOBUFS ;
577577 goto error ;
578578 }
@@ -646,7 +646,7 @@ int cachefiles_walk_to_object(struct cachefiles_object *parent,
646646 const struct address_space_operations * aops ;
647647
648648 ret = - EPERM ;
649- aops = object -> dentry -> d_inode -> i_mapping -> a_ops ;
649+ aops = d_backing_inode ( object -> dentry ) -> i_mapping -> a_ops ;
650650 if (!aops -> bmap )
651651 goto check_error ;
652652
@@ -659,7 +659,7 @@ int cachefiles_walk_to_object(struct cachefiles_object *parent,
659659 object -> new = 0 ;
660660 fscache_obtained_object (& object -> fscache );
661661
662- _leave (" = 0 [%lu]" , object -> dentry -> d_inode -> i_ino );
662+ _leave (" = 0 [%lu]" , d_backing_inode ( object -> dentry ) -> i_ino );
663663 return 0 ;
664664
665665create_error :
@@ -731,10 +731,10 @@ struct dentry *cachefiles_get_directory(struct cachefiles_cache *cache,
731731 }
732732
733733 _debug ("subdir -> %p %s" ,
734- subdir , subdir -> d_inode ? "positive" : "negative" );
734+ subdir , d_backing_inode ( subdir ) ? "positive" : "negative" );
735735
736736 /* we need to create the subdir if it doesn't exist yet */
737- if (! subdir -> d_inode ) {
737+ if (d_is_negative ( subdir ) ) {
738738 ret = cachefiles_has_space (cache , 1 , 0 );
739739 if (ret < 0 )
740740 goto mkdir_error ;
@@ -750,18 +750,18 @@ struct dentry *cachefiles_get_directory(struct cachefiles_cache *cache,
750750 if (ret < 0 )
751751 goto mkdir_error ;
752752
753- ASSERT (subdir -> d_inode );
753+ ASSERT (d_backing_inode ( subdir ) );
754754
755755 _debug ("mkdir -> %p{%p{ino=%lu}}" ,
756756 subdir ,
757- subdir -> d_inode ,
758- subdir -> d_inode -> i_ino );
757+ d_backing_inode ( subdir ) ,
758+ d_backing_inode ( subdir ) -> i_ino );
759759 }
760760
761761 mutex_unlock (& d_inode (dir )-> i_mutex );
762762
763763 /* we need to make sure the subdir is a directory */
764- ASSERT (subdir -> d_inode );
764+ ASSERT (d_backing_inode ( subdir ) );
765765
766766 if (!d_can_lookup (subdir )) {
767767 pr_err ("%s is not a directory\n" , dirname );
@@ -770,18 +770,18 @@ struct dentry *cachefiles_get_directory(struct cachefiles_cache *cache,
770770 }
771771
772772 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 )
782782 goto check_error ;
783783
784- _leave (" = [%lu]" , subdir -> d_inode -> i_ino );
784+ _leave (" = [%lu]" , d_backing_inode ( subdir ) -> i_ino );
785785 return subdir ;
786786
787787check_error :
@@ -836,12 +836,12 @@ static struct dentry *cachefiles_check_active(struct cachefiles_cache *cache,
836836 goto lookup_error ;
837837
838838 //_debug("victim -> %p %s",
839- // victim, victim->d_inode ? "positive" : "negative");
839+ // victim, d_backing_inode( victim) ? "positive" : "negative");
840840
841841 /* if the object is no longer there then we probably retired the object
842842 * at the netfs's request whilst the cull was in progress
843843 */
844- if (! victim -> d_inode ) {
844+ if (d_is_negative ( victim ) ) {
845845 mutex_unlock (& d_inode (dir )-> i_mutex );
846846 dput (victim );
847847 _leave (" = -ENOENT [absent]" );
@@ -913,7 +913,7 @@ int cachefiles_cull(struct cachefiles_cache *cache, struct dentry *dir,
913913 return PTR_ERR (victim );
914914
915915 _debug ("victim -> %p %s" ,
916- victim , victim -> d_inode ? "positive" : "negative" );
916+ victim , d_backing_inode ( victim ) ? "positive" : "negative" );
917917
918918 /* okay... the victim is not being used so we can cull it
919919 * - start by marking it as stale
0 commit comments