@@ -235,15 +235,15 @@ void ovl_dir_cache_free(struct inode *inode)
235
235
}
236
236
}
237
237
238
- static void ovl_cache_put (struct ovl_dir_file * od , struct dentry * dentry )
238
+ static void ovl_cache_put (struct ovl_dir_file * od , struct inode * inode )
239
239
{
240
240
struct ovl_dir_cache * cache = od -> cache ;
241
241
242
242
WARN_ON (cache -> refcount <= 0 );
243
243
cache -> refcount -- ;
244
244
if (!cache -> refcount ) {
245
- if (ovl_dir_cache (d_inode ( dentry ) ) == cache )
246
- ovl_set_dir_cache (d_inode ( dentry ) , NULL );
245
+ if (ovl_dir_cache (inode ) == cache )
246
+ ovl_set_dir_cache (inode , NULL );
247
247
248
248
ovl_cache_free (& cache -> entries );
249
249
kfree (cache );
@@ -323,15 +323,15 @@ static void ovl_dir_reset(struct file *file)
323
323
{
324
324
struct ovl_dir_file * od = file -> private_data ;
325
325
struct ovl_dir_cache * cache = od -> cache ;
326
- struct dentry * dentry = file -> f_path . dentry ;
326
+ struct inode * inode = file_inode ( file ) ;
327
327
bool is_real ;
328
328
329
- if (cache && ovl_dentry_version_get ( dentry ) != cache -> version ) {
330
- ovl_cache_put (od , dentry );
329
+ if (cache && ovl_inode_version_get ( inode ) != cache -> version ) {
330
+ ovl_cache_put (od , inode );
331
331
od -> cache = NULL ;
332
332
od -> cursor = NULL ;
333
333
}
334
- is_real = ovl_dir_is_real (dentry );
334
+ is_real = ovl_dir_is_real (inode );
335
335
if (od -> is_real != is_real ) {
336
336
/* is_real can only become false when dir is copied up */
337
337
if (WARN_ON (is_real ))
@@ -394,9 +394,10 @@ static struct ovl_dir_cache *ovl_cache_get(struct dentry *dentry)
394
394
{
395
395
int res ;
396
396
struct ovl_dir_cache * cache ;
397
+ struct inode * inode = d_inode (dentry );
397
398
398
- cache = ovl_dir_cache (d_inode ( dentry ) );
399
- if (cache && ovl_dentry_version_get ( dentry ) == cache -> version ) {
399
+ cache = ovl_dir_cache (inode );
400
+ if (cache && ovl_inode_version_get ( inode ) == cache -> version ) {
400
401
WARN_ON (!cache -> refcount );
401
402
cache -> refcount ++ ;
402
403
return cache ;
@@ -418,8 +419,8 @@ static struct ovl_dir_cache *ovl_cache_get(struct dentry *dentry)
418
419
return ERR_PTR (res );
419
420
}
420
421
421
- cache -> version = ovl_dentry_version_get ( dentry );
422
- ovl_set_dir_cache (d_inode ( dentry ) , cache );
422
+ cache -> version = ovl_inode_version_get ( inode );
423
+ ovl_set_dir_cache (inode , cache );
423
424
424
425
return cache ;
425
426
}
@@ -596,16 +597,17 @@ static struct ovl_dir_cache *ovl_cache_get_impure(const struct path *path)
596
597
{
597
598
int res ;
598
599
struct dentry * dentry = path -> dentry ;
600
+ struct inode * inode = d_inode (dentry );
599
601
struct ovl_fs * ofs = OVL_FS (dentry -> d_sb );
600
602
struct ovl_dir_cache * cache ;
601
603
602
- cache = ovl_dir_cache (d_inode ( dentry ) );
603
- if (cache && ovl_dentry_version_get ( dentry ) == cache -> version )
604
+ cache = ovl_dir_cache (inode );
605
+ if (cache && ovl_inode_version_get ( inode ) == cache -> version )
604
606
return cache ;
605
607
606
608
/* Impure cache is not refcounted, free it here */
607
- ovl_dir_cache_free (d_inode ( dentry ) );
608
- ovl_set_dir_cache (d_inode ( dentry ) , NULL );
609
+ ovl_dir_cache_free (inode );
610
+ ovl_set_dir_cache (inode , NULL );
609
611
610
612
cache = kzalloc (sizeof (struct ovl_dir_cache ), GFP_KERNEL );
611
613
if (!cache )
@@ -627,13 +629,13 @@ static struct ovl_dir_cache *ovl_cache_get_impure(const struct path *path)
627
629
OVL_XATTR_IMPURE );
628
630
ovl_drop_write (dentry );
629
631
}
630
- ovl_clear_flag (OVL_IMPURE , d_inode ( dentry ) );
632
+ ovl_clear_flag (OVL_IMPURE , inode );
631
633
kfree (cache );
632
634
return NULL ;
633
635
}
634
636
635
- cache -> version = ovl_dentry_version_get ( dentry );
636
- ovl_set_dir_cache (d_inode ( dentry ) , cache );
637
+ cache -> version = ovl_inode_version_get ( inode );
638
+ ovl_set_dir_cache (inode , cache );
637
639
638
640
return cache ;
639
641
}
@@ -675,7 +677,7 @@ static bool ovl_fill_real(struct dir_context *ctx, const char *name,
675
677
static bool ovl_is_impure_dir (struct file * file )
676
678
{
677
679
struct ovl_dir_file * od = file -> private_data ;
678
- struct inode * dir = d_inode (file -> f_path . dentry );
680
+ struct inode * dir = file_inode (file );
679
681
680
682
/*
681
683
* Only upper dir can be impure, but if we are in the middle of
@@ -893,7 +895,7 @@ static int ovl_dir_fsync(struct file *file, loff_t start, loff_t end,
893
895
struct file * realfile ;
894
896
int err ;
895
897
896
- err = ovl_sync_status (OVL_FS (file -> f_path . dentry -> d_sb ));
898
+ err = ovl_sync_status (OVL_FS (file_inode ( file ) -> i_sb ));
897
899
if (err <= 0 )
898
900
return err ;
899
901
@@ -913,7 +915,7 @@ static int ovl_dir_release(struct inode *inode, struct file *file)
913
915
914
916
if (od -> cache ) {
915
917
inode_lock (inode );
916
- ovl_cache_put (od , file -> f_path . dentry );
918
+ ovl_cache_put (od , inode );
917
919
inode_unlock (inode );
918
920
}
919
921
fput (od -> realfile );
@@ -942,7 +944,7 @@ static int ovl_dir_open(struct inode *inode, struct file *file)
942
944
return PTR_ERR (realfile );
943
945
}
944
946
od -> realfile = realfile ;
945
- od -> is_real = ovl_dir_is_real (file -> f_path . dentry );
947
+ od -> is_real = ovl_dir_is_real (inode );
946
948
od -> is_upper = OVL_TYPE_UPPER (type );
947
949
file -> private_data = od ;
948
950
0 commit comments