From: Chris Mason <chris.mason@oracle.com>
To: Suparna Bhattacharya <suparna@in.ibm.com>
Cc: linux-fsdevel@vger.kernel.org, akpm@osdl.org, zach.brown@oracle.com
Subject: Re: [RFC PATCH 3/3] DIO: don't fall back to buffered writes
Date: Wed, 1 Nov 2006 07:47:19 -0500 [thread overview]
Message-ID: <20061101124719.GG5620@think.oraclecorp.com> (raw)
In-Reply-To: <20061101105135.GB25882@in.ibm.com>
On Wed, Nov 01, 2006 at 04:21:37PM +0530, Suparna Bhattacharya wrote:
> > + /*
> > + * extend the file if needed, and drop i_mutex for non-aio writes.
> > + * We extend the file by creating a hole that is later filled in
> > + * during the O_DIRECT. Because pages are locked or placeholders
> > + * are inserted, the locking rules end up being the same as
> > + * mmap'd writes using writepage to fill holes
>
> I like the idea of extending the size in the beginning to avoid having
> to hold i_sem for the extended writes case. The only question is whether
> there is a semantics issue here - e.g. if there isn't enough space, would the
> app which did an append still see the size change even though the blocks
> themselves are not populated ? Of course we already have this happen in the
> -EIO case for AIO-DIO writes, no am not sure if this is an issue.
You're right, there is a semantic issue, I'm being a little loose with
the traditional write() expectations. The current code creates a hole
and does not remove it in the face of errors.
>
> > + */
> > + dio->reacquire_i_mutex = 0;
> > + if (dio_lock_type == DIO_LOCKING && (rw & WRITE)) {
>
> Hmm, we really do want to be able to avoid all these various locking
> mode checks inside the DIO code to simplify things. I thought you
> had mostly managed to do away with these in your previous patch.
> Unfortunately this change while it should help concurrency, brings
> that check back in. One of the plans I had earlier was to pull this
> up to a higher level - i.e. in the locking version of blockdev_direct_IO()
> thus doing away with the flag and related confusion. Do you think
> that would make sense ?
I went the other direction, making the flags a little more formal (patch
will go out today). I don't have strong feelings about this, but it
seems easiest to me to keep the flags inside blockdev_direct_IO.
>
>
> > + /* if our write goes past i_size, do an expanding
> > + * truncate to fill it before dropping i_mutex
> > + */
> > + if (end > i_size_read(inode) && iocb->ki_filp) {
> > + struct iattr newattrs;
> > + newattrs.ia_size = end;
> > + newattrs.ia_file = iocb->ki_filp;
> > + newattrs.ia_valid = ATTR_SIZE | ATTR_FILE;
> > + retval = notify_change(iocb->ki_filp->f_dentry,
> > + &newattrs);
> > + if (retval)
> > + goto out;
> > + }
> > + if (is_sync_kiocb(iocb)) {
> > + dio->reacquire_i_mutex = 1;
> > + mutex_unlock(&inode->i_mutex);
>
> BTW, don't the page locks cover the AIO case as well ? I'm wondering
> why we need this special case here.
Only because i_mutex is already dropped implicitly by the aio code when
we return. Ideally we could drop it sooner inside fs/direct-io.c, but
I'll leave that tuning for a later patch.
-chris
next prev parent reply other threads:[~2006-11-01 12:47 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-27 18:22 [RFC PATCH 0/3] O_DIRECT locking rework Chris Mason
2006-10-27 18:23 ` [RFC PATCH 1/3] Introduce a place holder page for the pagecache Chris Mason
2006-11-01 10:23 ` Suparna Bhattacharya
2006-11-01 12:41 ` Chris Mason
2006-11-03 7:12 ` Suparna Bhattacharya
2006-11-03 14:10 ` Chris Mason
2006-10-27 18:25 ` [RFC PATCH 2/3] Change O_DIRECT to use placeholders Chris Mason
2006-10-27 18:26 ` [RFC PATCH 3/3] DIO: don't fall back to buffered writes Chris Mason
2006-11-01 10:51 ` Suparna Bhattacharya
2006-11-01 12:47 ` Chris Mason [this message]
2006-11-03 7:25 ` Suparna Bhattacharya
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=20061101124719.GG5620@think.oraclecorp.com \
--to=chris.mason@oracle.com \
--cc=akpm@osdl.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=suparna@in.ibm.com \
--cc=zach.brown@oracle.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.