From: Jeff Moyer <jmoyer@redhat.com>
To: Jan Kara <jack@suse.cz>
Cc: linux-ext4@vger.kernel.org, xfs@oss.sgi.com,
linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH 2/3] ext4: honor the O_SYNC flag for aysnchronous direct I/O requests
Date: Mon, 06 Feb 2012 11:20:29 -0500 [thread overview]
Message-ID: <x49bopcq6gi.fsf@segfault.boston.devel.redhat.com> (raw)
In-Reply-To: <20120202173120.GA6640@quack.suse.cz> (Jan Kara's message of "Thu, 2 Feb 2012 18:31:20 +0100")
Jan Kara <jack@suse.cz> writes:
>> + /* workqueue for aio+dio+o_sync disk cache flushing */
>> + struct workqueue_struct *aio_dio_flush_wq;
>> +
> Hmm, looking at the patch I'm wondering why did you introduce the new
> workqueue? It seems dio_unwritten_wq would be enough? You just need to
> rename it to something more appropriate ;)
I used a new workqueue as the operations are blocking, and I didn't want
to hold up other progress. If you think re-using the unwritten_wq is
the right thing to do, I'm happy to comply.
>> + /*
>> + * This function has two callers. The first is the end_io_work
>> + * routine just below. This is an asynchronous completion context.
>> + * The second is in the fsync path. For the latter path, we can't
>> + * return from here until the job is done. Hence, we issue a
>> + * blocking blkdev_issue_flush call.
>> + */
>> + if (io->flag & EXT4_IO_END_NEEDS_SYNC) {
>> + /*
>> + * Ideally, we'd like to know if the force_commit routine
>> + * actually did send something to disk. If it didn't,
>> + * then we need to issue the cache flush by hand. For now,
>> + * play it safe and do both.
>> + */
>> + ret = ext4_force_commit(inode->i_sb);
>> + if (ret)
>> + goto endio;
>> + ret = blkdev_issue_flush(inode->i_sb->s_bdev, GFP_NOIO, NULL);
> Look at what ext4_sync_file() does. It's more efficient than this.
> You need something like:
> commit_tid = file->f_flags & __O_SYNC ? EXT4_I(inode)->i_sync_tid :
> EXT4_I(inode)->i_datasync_tid;
> if (journal->j_flags & JBD2_BARRIER &&
> !jbd2_trans_will_send_data_barrier(journal, commit_tid))
> needs_barrier = true;
> jbd2_log_start_commit(journal, commit_tid);
> jbd2_log_wait_commit(journal, commit_tid);
> if (needs_barrier)
> blkdev_issue_flush(inode->i_sb->s_bdev, GFP_NOIO, NULL);
Great, thanks for the pointer!
Cheers,
Jeff
next prev parent reply other threads:[~2012-02-06 16:20 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-27 21:15 [patch|rfc][0/3] fix aio+dio+O_SYNC writes Jeff Moyer
2012-01-27 21:15 ` [PATCH 1/3] xfs: honor the O_SYNC flag for aysnchronous direct I/O requests Jeff Moyer
2012-01-28 14:59 ` Christoph Hellwig
2012-01-27 21:15 ` [PATCH 2/3] ext4: " Jeff Moyer
2012-02-02 17:31 ` Jan Kara
2012-02-06 16:20 ` Jeff Moyer [this message]
2012-02-06 16:58 ` Jan Kara
2012-02-08 15:11 ` Jeff Moyer
2012-02-13 18:27 ` Jan Kara
2012-01-27 21:15 ` [PATCH 3/3] filemap: don't call generic_write_sync for -EIOCBQUEUED Jeff Moyer
2012-01-28 15:08 ` Martin Steigerwald
2012-02-02 17:52 ` Jan Kara
2012-02-06 16:33 ` Jeff Moyer
2012-02-06 19:55 ` Christoph Hellwig
2012-02-07 20:39 ` Jeff Moyer
2012-02-08 16:09 ` Jan Kara
2012-02-08 16:38 ` Jeff Moyer
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=x49bopcq6gi.fsf@segfault.boston.devel.redhat.com \
--to=jmoyer@redhat.com \
--cc=jack@suse.cz \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--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).