diff mbox series

[RFC,V2,05/12] fs: remove unneeded IS_DAX() check

Message ID 20200110192942.25021-6-ira.weiny@intel.com (mailing list archive)
State New, archived
Headers show
Series Enable per-file/directory DAX operations V2 | expand

Commit Message

Ira Weiny Jan. 10, 2020, 7:29 p.m. UTC
From: Ira Weiny <ira.weiny@intel.com>

The IS_DAX() check in io_is_direct() causes a race between changing the
DAX mode and creating the iocb flags.

Remove the check because DAX now emulates the page cache API and
therefore it does not matter if the file mode is DAX or not when the
iocb flags are created.

Signed-off-by: Ira Weiny <ira.weiny@intel.com>
---
 include/linux/fs.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jan Kara Jan. 16, 2020, 9:38 a.m. UTC | #1
On Fri 10-01-20 11:29:35, ira.weiny@intel.com wrote:
> From: Ira Weiny <ira.weiny@intel.com>
> 
> The IS_DAX() check in io_is_direct() causes a race between changing the
> DAX mode and creating the iocb flags.
> 
> Remove the check because DAX now emulates the page cache API and
> therefore it does not matter if the file mode is DAX or not when the
> iocb flags are created.
> 
> Signed-off-by: Ira Weiny <ira.weiny@intel.com>

The patch looks good to me. You can add:

Reviewed-by: Jan Kara <jack@suse.cz>

								Honza

> ---
>  include/linux/fs.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/linux/fs.h b/include/linux/fs.h
> index d7584bcef5d3..e11989502eac 100644
> --- a/include/linux/fs.h
> +++ b/include/linux/fs.h
> @@ -3365,7 +3365,7 @@ extern int file_update_time(struct file *file);
>  
>  static inline bool io_is_direct(struct file *filp)
>  {
> -	return (filp->f_flags & O_DIRECT) || IS_DAX(filp->f_mapping->host);
> +	return (filp->f_flags & O_DIRECT);
>  }
>  
>  static inline bool vma_is_dax(struct vm_area_struct *vma)
> -- 
> 2.21.0
>
Ira Weiny Jan. 16, 2020, 6:47 p.m. UTC | #2
On Thu, Jan 16, 2020 at 10:38:07AM +0100, Jan Kara wrote:
> On Fri 10-01-20 11:29:35, ira.weiny@intel.com wrote:
> > From: Ira Weiny <ira.weiny@intel.com>
> > 
> > The IS_DAX() check in io_is_direct() causes a race between changing the
> > DAX mode and creating the iocb flags.
> > 
> > Remove the check because DAX now emulates the page cache API and
> > therefore it does not matter if the file mode is DAX or not when the
> > iocb flags are created.
> > 
> > Signed-off-by: Ira Weiny <ira.weiny@intel.com>
> 
> The patch looks good to me. You can add:
> 
> Reviewed-by: Jan Kara <jack@suse.cz>

Thanks,
Ira

> 
> 								Honza
> 
> > ---
> >  include/linux/fs.h | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/include/linux/fs.h b/include/linux/fs.h
> > index d7584bcef5d3..e11989502eac 100644
> > --- a/include/linux/fs.h
> > +++ b/include/linux/fs.h
> > @@ -3365,7 +3365,7 @@ extern int file_update_time(struct file *file);
> >  
> >  static inline bool io_is_direct(struct file *filp)
> >  {
> > -	return (filp->f_flags & O_DIRECT) || IS_DAX(filp->f_mapping->host);
> > +	return (filp->f_flags & O_DIRECT);
> >  }
> >  
> >  static inline bool vma_is_dax(struct vm_area_struct *vma)
> > -- 
> > 2.21.0
> > 
> -- 
> Jan Kara <jack@suse.com>
> SUSE Labs, CR
diff mbox series

Patch

diff --git a/include/linux/fs.h b/include/linux/fs.h
index d7584bcef5d3..e11989502eac 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -3365,7 +3365,7 @@  extern int file_update_time(struct file *file);
 
 static inline bool io_is_direct(struct file *filp)
 {
-	return (filp->f_flags & O_DIRECT) || IS_DAX(filp->f_mapping->host);
+	return (filp->f_flags & O_DIRECT);
 }
 
 static inline bool vma_is_dax(struct vm_area_struct *vma)