From: Dave Chinner <david@fromorbit.com>
To: Eric Sandeen <sandeen@sandeen.net>
Cc: Eric Sandeen <sandeen@redhat.com>, xfs-oss <xfs@oss.sgi.com>
Subject: Re: [PATCH] xfs: allow logical-sector sized O_DIRECT for any fs sector size
Date: Fri, 17 Jan 2014 10:21:32 +1100 [thread overview]
Message-ID: <20140116232132.GT3431@dastard> (raw)
In-Reply-To: <52D71115.1070309@sandeen.net>
On Wed, Jan 15, 2014 at 04:52:05PM -0600, Eric Sandeen wrote:
> On 1/15/14, 4:38 PM, Dave Chinner wrote:
> > On Wed, Jan 15, 2014 at 11:59:45AM -0600, Eric Sandeen wrote:
> >> diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c
> >> index 33ad9a7..1f3431f 100644
> >> --- a/fs/xfs/xfs_ioctl.c
> >> +++ b/fs/xfs/xfs_ioctl.c
> >> @@ -1587,7 +1587,12 @@ xfs_file_ioctl(
> >> XFS_IS_REALTIME_INODE(ip) ?
> >> mp->m_rtdev_targp : mp->m_ddev_targp;
> >>
> >> - da.d_mem = da.d_miniosz = 1 << target->bt_sshift;
> >> + /*
> >> + * Report device physical sector size as "optimal" minimum,
> >> + * unless blocksize is smaller than that.
> >> + */
> >> + da.d_miniosz = min(target->bt_pssize, target->bt_bsize);
> >
> > Just grab the filesysetm block size from the xfs_mount:
> >
> > da.d_miniosz = min(target->bt_pssize, mp->m_sb.sb_blocksize);
> >
> >> + da.d_mem = da.d_miniosz;
> >
> > I'd suggest that this should be PAGE_SIZE - it's for memory buffer
> > alignment, not IO alignment, so using the IO alignment just seems
> > wrong to me...
>
> Ok. Was just sticking close to what we had before.
>
> So:
> da.d_miniosz = min(target->bt_pssize, mp->m_sb.sb_blocksize);
> da.d_mem = PAGE_SIZE;
>
> ? Then we can have a minimum IO size of 512, and a memory alignment of
> 4k, isn't that a little odd?
>
> (IOWs we could do 512-aligned memory before, right? What's the downside,
> or the value in changing it now?)
We can do arbitrary byte aligned buffers if I understand
get_user_pages() correctly - it just maps the page under the buffer
into the kernel address space and then the bio is pointed at it.
AFAICT, the reason for the "memory buffer needs 512 byte alignment"
is simply that this is the minimum IO size supported.
However, for large IOs, 512 byte alignment is not really optimal. If
we don't align the buffer to PAGE_SIZE, then we have partial head
and tail pages, so for a 512k IO we need to map 129 pages into a bio
instead of 128. When you have hardware that can only handle 128
segments in a DMA transfer, that means the 512k IO needs to be sent
in two IOs rather than one.
There's quite a bit of hardware out there that have a limit of 128
segments to each IO....
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2014-01-16 23:23 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-15 17:59 [PATCH] xfs: allow logical-sector sized O_DIRECT for any fs sector size Eric Sandeen
2014-01-15 22:38 ` Dave Chinner
2014-01-15 22:52 ` Eric Sandeen
2014-01-16 23:21 ` Dave Chinner [this message]
2014-01-17 17:35 ` Eric Sandeen
2014-01-17 20:22 ` [PATCH 0/3 V2] " Eric Sandeen
2014-01-17 20:23 ` [PATCH 1/3] xfs: clean up xfs_buftarg Eric Sandeen
2014-01-20 14:21 ` Brian Foster
2014-01-17 20:26 ` [PATCH 2/3] xfs: rename xfs_buftarg structure members Eric Sandeen
2014-01-17 21:12 ` Roger Willcocks
2014-01-17 21:13 ` Eric Sandeen
2014-01-17 21:14 ` [PATCH 2/3 V2] " Eric Sandeen
2014-01-20 14:21 ` Brian Foster
2014-01-17 20:28 ` [PATCH 3/3] xfs: allow logical-sector sized O_DIRECT IOs Eric Sandeen
2014-01-20 14:21 ` Brian Foster
2014-01-20 14:53 ` 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=20140116232132.GT3431@dastard \
--to=david@fromorbit.com \
--cc=sandeen@redhat.com \
--cc=sandeen@sandeen.net \
--cc=xfs@oss.sgi.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).