diff options
author | Martin Brandenburg <martin@omnibond.com> | 2016-08-02 16:32:15 -0400 |
---|---|---|
committer | Martin Brandenburg <martin@omnibond.com> | 2016-08-08 15:12:29 -0400 |
commit | ed1e158777fa73ac577dcd4f67062b944b587493 (patch) | |
tree | e72f67dd9634cf02bc90408b0d9c5e777e0c1078 /fs/orangefs | |
parent | 680908e5046bdd37a678691d881d98486c3e9a53 (diff) |
orangefs: re-add flush_racache from out-of-tree
Signed-off-by: Martin Brandenburg <martin@omnibond.com>
Diffstat (limited to 'fs/orangefs')
-rw-r--r-- | fs/orangefs/file.c | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/fs/orangefs/file.c b/fs/orangefs/file.c index c14eab567f56..43c08b5c7168 100644 --- a/fs/orangefs/file.c +++ b/fs/orangefs/file.c | |||
@@ -14,6 +14,32 @@ | |||
14 | #include <linux/fs.h> | 14 | #include <linux/fs.h> |
15 | #include <linux/pagemap.h> | 15 | #include <linux/pagemap.h> |
16 | 16 | ||
17 | static int flush_racache(struct inode *inode) | ||
18 | { | ||
19 | struct orangefs_inode_s *orangefs_inode = ORANGEFS_I(inode); | ||
20 | struct orangefs_kernel_op_s *new_op; | ||
21 | int ret; | ||
22 | |||
23 | gossip_debug(GOSSIP_UTILS_DEBUG, | ||
24 | "%s: %pU: Handle is %pU | fs_id %d\n", __func__, | ||
25 | get_khandle_from_ino(inode), &orangefs_inode->refn.khandle, | ||
26 | orangefs_inode->refn.fs_id); | ||
27 | |||
28 | new_op = op_alloc(ORANGEFS_VFS_OP_RA_FLUSH); | ||
29 | if (!new_op) | ||
30 | return -ENOMEM; | ||
31 | new_op->upcall.req.ra_cache_flush.refn = orangefs_inode->refn; | ||
32 | |||
33 | ret = service_operation(new_op, "orangefs_flush_racache", | ||
34 | get_interruptible_flag(inode)); | ||
35 | |||
36 | gossip_debug(GOSSIP_UTILS_DEBUG, "%s: got return value of %d\n", | ||
37 | __func__, ret); | ||
38 | |||
39 | op_release(new_op); | ||
40 | return ret; | ||
41 | } | ||
42 | |||
17 | /* | 43 | /* |
18 | * Copy to client-core's address space from the buffers specified | 44 | * Copy to client-core's address space from the buffers specified |
19 | * by the iovec upto total_size bytes. | 45 | * by the iovec upto total_size bytes. |
@@ -597,9 +623,15 @@ static int orangefs_file_release(struct inode *inode, struct file *file) | |||
597 | */ | 623 | */ |
598 | if (file->f_path.dentry->d_inode && | 624 | if (file->f_path.dentry->d_inode && |
599 | file->f_path.dentry->d_inode->i_mapping && | 625 | file->f_path.dentry->d_inode->i_mapping && |
600 | mapping_nrpages(&file->f_path.dentry->d_inode->i_data)) | 626 | mapping_nrpages(&file->f_path.dentry->d_inode->i_data)) { |
627 | gossip_debug(GOSSIP_INODE_DEBUG, | ||
628 | "calling flush_racache on %pU\n", | ||
629 | get_khandle_from_ino(inode)); | ||
630 | flush_racache(inode); | ||
631 | gossip_debug(GOSSIP_INODE_DEBUG, "flush_racache finished\n"); | ||
601 | truncate_inode_pages(file->f_path.dentry->d_inode->i_mapping, | 632 | truncate_inode_pages(file->f_path.dentry->d_inode->i_mapping, |
602 | 0); | 633 | 0); |
634 | } | ||
603 | return 0; | 635 | return 0; |
604 | } | 636 | } |
605 | 637 | ||