diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-10-27 15:52:46 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-10-27 15:52:46 -0400 |
commit | e3300ffef0653774f1099cab153d25d24bd773ce (patch) | |
tree | 4d5949f4355df7a222fada6ac5b285db88d048e6 | |
parent | e890038e6a0b1f1c5a5a0037025499704353a3eb (diff) | |
parent | 804b1737d71253f01621d2a37a0dce6279a2d440 (diff) |
Merge tag 'for-linus-4.9-rc2-ofs-1' of git://git.kernel.org/pub/scm/linux/kernel/git/hubcap/linux
Pull oreangefs updates from Mike Marshall:
"A couple of orangefs cleanups sent in by other developers:
- use d_fsdata instead of d_time (Miklos Szeredi)
- use file_inode(file) instead of file->f_path.dentry->d_inode (Amir
Goldstein)"
* tag 'for-linus-4.9-rc2-ofs-1' of git://git.kernel.org/pub/scm/linux/kernel/git/hubcap/linux:
orangefs: don't use d_time
orangefs: user file_inode() where it is due
-rw-r--r-- | fs/orangefs/dcache.c | 5 | ||||
-rw-r--r-- | fs/orangefs/file.c | 14 | ||||
-rw-r--r-- | fs/orangefs/namei.c | 8 | ||||
-rw-r--r-- | fs/orangefs/orangefs-kernel.h | 7 |
4 files changed, 21 insertions, 13 deletions
diff --git a/fs/orangefs/dcache.c b/fs/orangefs/dcache.c index 1e8fe844e69f..5355efba4bc8 100644 --- a/fs/orangefs/dcache.c +++ b/fs/orangefs/dcache.c | |||
@@ -73,7 +73,7 @@ static int orangefs_revalidate_lookup(struct dentry *dentry) | |||
73 | } | 73 | } |
74 | } | 74 | } |
75 | 75 | ||
76 | dentry->d_time = jiffies + orangefs_dcache_timeout_msecs*HZ/1000; | 76 | orangefs_set_timeout(dentry); |
77 | ret = 1; | 77 | ret = 1; |
78 | out_release_op: | 78 | out_release_op: |
79 | op_release(new_op); | 79 | op_release(new_op); |
@@ -94,8 +94,9 @@ out_drop: | |||
94 | static int orangefs_d_revalidate(struct dentry *dentry, unsigned int flags) | 94 | static int orangefs_d_revalidate(struct dentry *dentry, unsigned int flags) |
95 | { | 95 | { |
96 | int ret; | 96 | int ret; |
97 | unsigned long time = (unsigned long) dentry->d_fsdata; | ||
97 | 98 | ||
98 | if (time_before(jiffies, dentry->d_time)) | 99 | if (time_before(jiffies, time)) |
99 | return 1; | 100 | return 1; |
100 | 101 | ||
101 | if (flags & LOOKUP_RCU) | 102 | if (flags & LOOKUP_RCU) |
diff --git a/fs/orangefs/file.c b/fs/orangefs/file.c index 66ea0cc37b18..02cc6139ec90 100644 --- a/fs/orangefs/file.c +++ b/fs/orangefs/file.c | |||
@@ -621,9 +621,9 @@ static int orangefs_file_release(struct inode *inode, struct file *file) | |||
621 | * readahead cache (if any); this forces an expensive refresh of | 621 | * readahead cache (if any); this forces an expensive refresh of |
622 | * data for the next caller of mmap (or 'get_block' accesses) | 622 | * data for the next caller of mmap (or 'get_block' accesses) |
623 | */ | 623 | */ |
624 | if (file->f_path.dentry->d_inode && | 624 | if (file_inode(file) && |
625 | file->f_path.dentry->d_inode->i_mapping && | 625 | file_inode(file)->i_mapping && |
626 | mapping_nrpages(&file->f_path.dentry->d_inode->i_data)) { | 626 | mapping_nrpages(&file_inode(file)->i_data)) { |
627 | if (orangefs_features & ORANGEFS_FEATURE_READAHEAD) { | 627 | if (orangefs_features & ORANGEFS_FEATURE_READAHEAD) { |
628 | gossip_debug(GOSSIP_INODE_DEBUG, | 628 | gossip_debug(GOSSIP_INODE_DEBUG, |
629 | "calling flush_racache on %pU\n", | 629 | "calling flush_racache on %pU\n", |
@@ -632,7 +632,7 @@ static int orangefs_file_release(struct inode *inode, struct file *file) | |||
632 | gossip_debug(GOSSIP_INODE_DEBUG, | 632 | gossip_debug(GOSSIP_INODE_DEBUG, |
633 | "flush_racache finished\n"); | 633 | "flush_racache finished\n"); |
634 | } | 634 | } |
635 | truncate_inode_pages(file->f_path.dentry->d_inode->i_mapping, | 635 | truncate_inode_pages(file_inode(file)->i_mapping, |
636 | 0); | 636 | 0); |
637 | } | 637 | } |
638 | return 0; | 638 | return 0; |
@@ -648,7 +648,7 @@ static int orangefs_fsync(struct file *file, | |||
648 | { | 648 | { |
649 | int ret = -EINVAL; | 649 | int ret = -EINVAL; |
650 | struct orangefs_inode_s *orangefs_inode = | 650 | struct orangefs_inode_s *orangefs_inode = |
651 | ORANGEFS_I(file->f_path.dentry->d_inode); | 651 | ORANGEFS_I(file_inode(file)); |
652 | struct orangefs_kernel_op_s *new_op = NULL; | 652 | struct orangefs_kernel_op_s *new_op = NULL; |
653 | 653 | ||
654 | /* required call */ | 654 | /* required call */ |
@@ -661,7 +661,7 @@ static int orangefs_fsync(struct file *file, | |||
661 | 661 | ||
662 | ret = service_operation(new_op, | 662 | ret = service_operation(new_op, |
663 | "orangefs_fsync", | 663 | "orangefs_fsync", |
664 | get_interruptible_flag(file->f_path.dentry->d_inode)); | 664 | get_interruptible_flag(file_inode(file))); |
665 | 665 | ||
666 | gossip_debug(GOSSIP_FILE_DEBUG, | 666 | gossip_debug(GOSSIP_FILE_DEBUG, |
667 | "orangefs_fsync got return value of %d\n", | 667 | "orangefs_fsync got return value of %d\n", |
@@ -669,7 +669,7 @@ static int orangefs_fsync(struct file *file, | |||
669 | 669 | ||
670 | op_release(new_op); | 670 | op_release(new_op); |
671 | 671 | ||
672 | orangefs_flush_inode(file->f_path.dentry->d_inode); | 672 | orangefs_flush_inode(file_inode(file)); |
673 | return ret; | 673 | return ret; |
674 | } | 674 | } |
675 | 675 | ||
diff --git a/fs/orangefs/namei.c b/fs/orangefs/namei.c index d15d3d2dba62..a290ff6ec756 100644 --- a/fs/orangefs/namei.c +++ b/fs/orangefs/namei.c | |||
@@ -72,7 +72,7 @@ static int orangefs_create(struct inode *dir, | |||
72 | 72 | ||
73 | d_instantiate(dentry, inode); | 73 | d_instantiate(dentry, inode); |
74 | unlock_new_inode(inode); | 74 | unlock_new_inode(inode); |
75 | dentry->d_time = jiffies + orangefs_dcache_timeout_msecs*HZ/1000; | 75 | orangefs_set_timeout(dentry); |
76 | ORANGEFS_I(inode)->getattr_time = jiffies - 1; | 76 | ORANGEFS_I(inode)->getattr_time = jiffies - 1; |
77 | 77 | ||
78 | gossip_debug(GOSSIP_NAME_DEBUG, | 78 | gossip_debug(GOSSIP_NAME_DEBUG, |
@@ -183,7 +183,7 @@ static struct dentry *orangefs_lookup(struct inode *dir, struct dentry *dentry, | |||
183 | goto out; | 183 | goto out; |
184 | } | 184 | } |
185 | 185 | ||
186 | dentry->d_time = jiffies + orangefs_dcache_timeout_msecs*HZ/1000; | 186 | orangefs_set_timeout(dentry); |
187 | 187 | ||
188 | inode = orangefs_iget(dir->i_sb, &new_op->downcall.resp.lookup.refn); | 188 | inode = orangefs_iget(dir->i_sb, &new_op->downcall.resp.lookup.refn); |
189 | if (IS_ERR(inode)) { | 189 | if (IS_ERR(inode)) { |
@@ -322,7 +322,7 @@ static int orangefs_symlink(struct inode *dir, | |||
322 | 322 | ||
323 | d_instantiate(dentry, inode); | 323 | d_instantiate(dentry, inode); |
324 | unlock_new_inode(inode); | 324 | unlock_new_inode(inode); |
325 | dentry->d_time = jiffies + orangefs_dcache_timeout_msecs*HZ/1000; | 325 | orangefs_set_timeout(dentry); |
326 | ORANGEFS_I(inode)->getattr_time = jiffies - 1; | 326 | ORANGEFS_I(inode)->getattr_time = jiffies - 1; |
327 | 327 | ||
328 | gossip_debug(GOSSIP_NAME_DEBUG, | 328 | gossip_debug(GOSSIP_NAME_DEBUG, |
@@ -386,7 +386,7 @@ static int orangefs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode | |||
386 | 386 | ||
387 | d_instantiate(dentry, inode); | 387 | d_instantiate(dentry, inode); |
388 | unlock_new_inode(inode); | 388 | unlock_new_inode(inode); |
389 | dentry->d_time = jiffies + orangefs_dcache_timeout_msecs*HZ/1000; | 389 | orangefs_set_timeout(dentry); |
390 | ORANGEFS_I(inode)->getattr_time = jiffies - 1; | 390 | ORANGEFS_I(inode)->getattr_time = jiffies - 1; |
391 | 391 | ||
392 | gossip_debug(GOSSIP_NAME_DEBUG, | 392 | gossip_debug(GOSSIP_NAME_DEBUG, |
diff --git a/fs/orangefs/orangefs-kernel.h b/fs/orangefs/orangefs-kernel.h index 0a82048f3aaf..3bf803d732c5 100644 --- a/fs/orangefs/orangefs-kernel.h +++ b/fs/orangefs/orangefs-kernel.h | |||
@@ -580,4 +580,11 @@ static inline void orangefs_i_size_write(struct inode *inode, loff_t i_size) | |||
580 | #endif | 580 | #endif |
581 | } | 581 | } |
582 | 582 | ||
583 | static inline void orangefs_set_timeout(struct dentry *dentry) | ||
584 | { | ||
585 | unsigned long time = jiffies + orangefs_dcache_timeout_msecs*HZ/1000; | ||
586 | |||
587 | dentry->d_fsdata = (void *) time; | ||
588 | } | ||
589 | |||
583 | #endif /* __ORANGEFSKERNEL_H */ | 590 | #endif /* __ORANGEFSKERNEL_H */ |