linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] orangefs: user file_inode() where it is due
@ 2016-10-21  4:33 Amir Goldstein
  2016-10-21 15:09 ` Mike Marshall
  0 siblings, 1 reply; 2+ messages in thread
From: Amir Goldstein @ 2016-10-21  4:33 UTC (permalink / raw)
  To: Mike Marshall; +Cc: Miklos Szeredi, linux-fsdevel

Replace wrong use of file->f_path.dentry->d_inode with file_inode(file).
In case orangefs ever finds itself as an overelayfs layer, it would want
to get its own inode and not overlayfs's inode.

DISCLAIMER: I did not test this patch because I do not know how to setup
            an orangefs mount

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
---
 fs/orangefs/file.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/fs/orangefs/file.c b/fs/orangefs/file.c
index 66ea0cc..02cc613 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)
 	 * readahead cache (if any); this forces an expensive refresh of
 	 * data for the next caller of mmap (or 'get_block' accesses)
 	 */
-	if (file->f_path.dentry->d_inode &&
-	    file->f_path.dentry->d_inode->i_mapping &&
-	    mapping_nrpages(&file->f_path.dentry->d_inode->i_data)) {
+	if (file_inode(file) &&
+	    file_inode(file)->i_mapping &&
+	    mapping_nrpages(&file_inode(file)->i_data)) {
 		if (orangefs_features & ORANGEFS_FEATURE_READAHEAD) {
 			gossip_debug(GOSSIP_INODE_DEBUG,
 			    "calling flush_racache on %pU\n",
@@ -632,7 +632,7 @@ static int orangefs_file_release(struct inode *inode, struct file *file)
 			gossip_debug(GOSSIP_INODE_DEBUG,
 			    "flush_racache finished\n");
 		}
-		truncate_inode_pages(file->f_path.dentry->d_inode->i_mapping,
+		truncate_inode_pages(file_inode(file)->i_mapping,
 				     0);
 	}
 	return 0;
@@ -648,7 +648,7 @@ static int orangefs_fsync(struct file *file,
 {
 	int ret = -EINVAL;
 	struct orangefs_inode_s *orangefs_inode =
-		ORANGEFS_I(file->f_path.dentry->d_inode);
+		ORANGEFS_I(file_inode(file));
 	struct orangefs_kernel_op_s *new_op = NULL;
 
 	/* required call */
@@ -661,7 +661,7 @@ static int orangefs_fsync(struct file *file,
 
 	ret = service_operation(new_op,
 			"orangefs_fsync",
-			get_interruptible_flag(file->f_path.dentry->d_inode));
+			get_interruptible_flag(file_inode(file)));
 
 	gossip_debug(GOSSIP_FILE_DEBUG,
 		     "orangefs_fsync got return value of %d\n",
@@ -669,7 +669,7 @@ static int orangefs_fsync(struct file *file,
 
 	op_release(new_op);
 
-	orangefs_flush_inode(file->f_path.dentry->d_inode);
+	orangefs_flush_inode(file_inode(file));
 	return ret;
 }
 
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] orangefs: user file_inode() where it is due
  2016-10-21  4:33 [PATCH] orangefs: user file_inode() where it is due Amir Goldstein
@ 2016-10-21 15:09 ` Mike Marshall
  0 siblings, 0 replies; 2+ messages in thread
From: Mike Marshall @ 2016-10-21 15:09 UTC (permalink / raw)
  To: Amir Goldstein; +Cc: Miklos Szeredi, linux-fsdevel

I'm away from work today, but I'll test it.

Amir: orangefs.txt includes a cheatsheet on how to set up Orangefs
enough to test. Orangefs is almost as easy to install as
"configure/make/make install". If anyone reads through the
cheatsheet and thinks it needs improved, I'd love to hear it.

Thanks...

-Mike

On Fri, Oct 21, 2016 at 12:33 AM, Amir Goldstein <amir73il@gmail.com> wrote:
> Replace wrong use of file->f_path.dentry->d_inode with file_inode(file).
> In case orangefs ever finds itself as an overelayfs layer, it would want
> to get its own inode and not overlayfs's inode.
>
> DISCLAIMER: I did not test this patch because I do not know how to setup
>             an orangefs mount
>
> Signed-off-by: Amir Goldstein <amir73il@gmail.com>
> ---
>  fs/orangefs/file.c | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/fs/orangefs/file.c b/fs/orangefs/file.c
> index 66ea0cc..02cc613 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)
>          * readahead cache (if any); this forces an expensive refresh of
>          * data for the next caller of mmap (or 'get_block' accesses)
>          */
> -       if (file->f_path.dentry->d_inode &&
> -           file->f_path.dentry->d_inode->i_mapping &&
> -           mapping_nrpages(&file->f_path.dentry->d_inode->i_data)) {
> +       if (file_inode(file) &&
> +           file_inode(file)->i_mapping &&
> +           mapping_nrpages(&file_inode(file)->i_data)) {
>                 if (orangefs_features & ORANGEFS_FEATURE_READAHEAD) {
>                         gossip_debug(GOSSIP_INODE_DEBUG,
>                             "calling flush_racache on %pU\n",
> @@ -632,7 +632,7 @@ static int orangefs_file_release(struct inode *inode, struct file *file)
>                         gossip_debug(GOSSIP_INODE_DEBUG,
>                             "flush_racache finished\n");
>                 }
> -               truncate_inode_pages(file->f_path.dentry->d_inode->i_mapping,
> +               truncate_inode_pages(file_inode(file)->i_mapping,
>                                      0);
>         }
>         return 0;
> @@ -648,7 +648,7 @@ static int orangefs_fsync(struct file *file,
>  {
>         int ret = -EINVAL;
>         struct orangefs_inode_s *orangefs_inode =
> -               ORANGEFS_I(file->f_path.dentry->d_inode);
> +               ORANGEFS_I(file_inode(file));
>         struct orangefs_kernel_op_s *new_op = NULL;
>
>         /* required call */
> @@ -661,7 +661,7 @@ static int orangefs_fsync(struct file *file,
>
>         ret = service_operation(new_op,
>                         "orangefs_fsync",
> -                       get_interruptible_flag(file->f_path.dentry->d_inode));
> +                       get_interruptible_flag(file_inode(file)));
>
>         gossip_debug(GOSSIP_FILE_DEBUG,
>                      "orangefs_fsync got return value of %d\n",
> @@ -669,7 +669,7 @@ static int orangefs_fsync(struct file *file,
>
>         op_release(new_op);
>
> -       orangefs_flush_inode(file->f_path.dentry->d_inode);
> +       orangefs_flush_inode(file_inode(file));
>         return ret;
>  }
>
> --
> 2.7.4
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-10-21 15:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-21  4:33 [PATCH] orangefs: user file_inode() where it is due Amir Goldstein
2016-10-21 15:09 ` Mike Marshall

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).