linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Eric Sandeen <sandeen@redhat.com>
Cc: linux-xfs <linux-xfs@vger.kernel.org>, Jeff Moyer <jmoyer@redhat.com>
Subject: Re: [PATCH] xfs: return correct XFS_IOC_DIOINFO for DAX inode
Date: Tue, 2 Apr 2019 10:56:32 -0700	[thread overview]
Message-ID: <20190402175632.GD5147@magnolia> (raw)
In-Reply-To: <b3af182f-a547-9d04-3b29-232857e83fc4@redhat.com>

On Tue, Apr 02, 2019 at 10:44:38AM -0500, Eric Sandeen wrote:
> pmem is byte addressable, and indeed byte-aligned DIO works on
> a DAX file.  So, teach XFS_IOC_DIOINFO to return the correct
> alignment information if IS_DAX(inode).

If it's a DAX filesystem, do we want to try to steer people towards
things like 2MB pages since (in theory) we can get away with fewer page
table mappings?  And (seeing as that's mmap that cares, not directio)
would advertising preferential page mapping sizes be more appropriate
advertised in a different ioctl?

--D

> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
> ---
> 
> diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c
> index 6ecdbb3..35eae7d 100644
> --- a/fs/xfs/xfs_ioctl.c
> +++ b/fs/xfs/xfs_ioctl.c
> @@ -1919,12 +1919,21 @@ xfs_file_ioctl(
>  	}
>  	case XFS_IOC_DIOINFO: {
>  		struct dioattr	da;
> -		xfs_buftarg_t	*target =
> -			XFS_IS_REALTIME_INODE(ip) ?
> -			mp->m_rtdev_targp : mp->m_ddev_targp;
>  
> -		da.d_mem =  da.d_miniosz = target->bt_logical_sectorsize;
> -		da.d_maxiosz = INT_MAX & ~(da.d_miniosz - 1);
> +		if (IS_DAX(inode)) {
> +			/* pmem is byte addressable */
> +			da.d_mem = 1;
> +			da.d_miniosz = 1;
> +			da.d_maxiosz = INT_MAX;
> +		} else {
> +			xfs_buftarg_t	*target =
> +				XFS_IS_REALTIME_INODE(ip) ?
> +				mp->m_rtdev_targp : mp->m_ddev_targp;
> +
> +			da.d_mem = target->bt_logical_sectorsize;
> +			da.d_miniosz = target->bt_logical_sectorsize;
> +			da.d_maxiosz = INT_MAX & ~(da.d_miniosz - 1);
> +		}
>  
>  		if (copy_to_user(arg, &da, sizeof(da)))
>  			return -EFAULT;
> 

  reply	other threads:[~2019-04-02 18:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-02 15:44 [PATCH] xfs: return correct XFS_IOC_DIOINFO for DAX inode Eric Sandeen
2019-04-02 17:56 ` Darrick J. Wong [this message]
2019-04-02 18:08   ` Eric Sandeen
2019-04-02 21:31   ` Dave Chinner
2019-04-03  1:08     ` Eric Sandeen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190402175632.GD5147@magnolia \
    --to=darrick.wong@oracle.com \
    --cc=jmoyer@redhat.com \
    --cc=linux-xfs@vger.kernel.org \
    --cc=sandeen@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).