* Question about REQ_FLUSH and bios with data
@ 2013-08-09 19:09 scameron
2013-08-09 19:11 ` scameron
2013-08-09 20:18 ` Steven Whitehouse
0 siblings, 2 replies; 4+ messages in thread
From: scameron @ 2013-08-09 19:09 UTC (permalink / raw)
To: linux-kernel; +Cc: jens.axboe, tj, scameron
So, I'm working on a block driver using the make_request_fn
interface, and have to handle a bio that comes in with
(bi_rw & REQ_FLUSH) set AND data to transfer.
According to Documentation/block/writeback_cache_control.txt:
The REQ_FLUSH flag can be OR ed into the r/w flags of a
bio submitted from the filesystem and will make sure the
volatile cache of the storage device has been flushed
before the actual I/O operation is started.
So I've written code that handles that case, along with the
various error cases I might encounter, I think, which leads
to my question:
How do I get such a bio with a data transfer AND the REQ_FLUSH bit
set to come into the driver? Just wondering how to test this case.
Thanks,
(I cc'ed Tejun Heo just because his name is in block/blk-flush.c)
-- steve
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Question about REQ_FLUSH and bios with data
2013-08-09 19:09 Question about REQ_FLUSH and bios with data scameron
@ 2013-08-09 19:11 ` scameron
2013-08-09 20:18 ` Steven Whitehouse
1 sibling, 0 replies; 4+ messages in thread
From: scameron @ 2013-08-09 19:11 UTC (permalink / raw)
To: linux-kernel; +Cc: axboe, tj, scameron
On Fri, Aug 09, 2013 at 02:09:34PM -0500, scameron@beardog.cce.hp.com wrote:
>
> So, I'm working on a block driver using the make_request_fn
> interface, and have to handle a bio that comes in with
> (bi_rw & REQ_FLUSH) set AND data to transfer.
>
> According to Documentation/block/writeback_cache_control.txt:
>
> The REQ_FLUSH flag can be OR ed into the r/w flags of a
> bio submitted from the filesystem and will make sure the
> volatile cache of the storage device has been flushed
> before the actual I/O operation is started.
>
> So I've written code that handles that case, along with the
> various error cases I might encounter, I think, which leads
> to my question:
>
> How do I get such a bio with a data transfer AND the REQ_FLUSH bit
> set to come into the driver? Just wondering how to test this case.
>
> Thanks,
>
> (I cc'ed Tejun Heo just because his name is in block/blk-flush.c)
>
> -- steve
Oops, you'd think I'd know Jens's email address by now.
-- steve
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Question about REQ_FLUSH and bios with data
2013-08-09 19:09 Question about REQ_FLUSH and bios with data scameron
2013-08-09 19:11 ` scameron
@ 2013-08-09 20:18 ` Steven Whitehouse
2013-08-09 20:34 ` scameron
1 sibling, 1 reply; 4+ messages in thread
From: Steven Whitehouse @ 2013-08-09 20:18 UTC (permalink / raw)
To: scameron; +Cc: linux-kernel, jens.axboe, tj
Hi,
On Fri, 2013-08-09 at 14:09 -0500, scameron@beardog.cce.hp.com wrote:
> So, I'm working on a block driver using the make_request_fn
> interface, and have to handle a bio that comes in with
> (bi_rw & REQ_FLUSH) set AND data to transfer.
>
> According to Documentation/block/writeback_cache_control.txt:
>
> The REQ_FLUSH flag can be OR ed into the r/w flags of a
> bio submitted from the filesystem and will make sure the
> volatile cache of the storage device has been flushed
> before the actual I/O operation is started.
>
> So I've written code that handles that case, along with the
> various error cases I might encounter, I think, which leads
> to my question:
>
> How do I get such a bio with a data transfer AND the REQ_FLUSH bit
> set to come into the driver? Just wondering how to test this case.
>
GFS2 does this... if you look at the log flush code and the function
log_write_header() in particular, you'll see that it sets this on each
log header that gets written. You don't need a cluster to generate this
kind of i/o, just supply mkfs.gfs2 with -p lock_nolock and mount it as a
local filesystem. The combination of touch foo; sync should be enough to
generate a log flush writing a log header with this flag set,
Steve.
> Thanks,
>
> (I cc'ed Tejun Heo just because his name is in block/blk-flush.c)
>
> -- steve
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Question about REQ_FLUSH and bios with data
2013-08-09 20:18 ` Steven Whitehouse
@ 2013-08-09 20:34 ` scameron
0 siblings, 0 replies; 4+ messages in thread
From: scameron @ 2013-08-09 20:34 UTC (permalink / raw)
To: Steven Whitehouse; +Cc: linux-kernel, jens.axboe, tj, scameron
On Fri, Aug 09, 2013 at 09:18:15PM +0100, Steven Whitehouse wrote:
> Hi,
>
> On Fri, 2013-08-09 at 14:09 -0500, scameron@beardog.cce.hp.com wrote:
> > So, I'm working on a block driver using the make_request_fn
> > interface, and have to handle a bio that comes in with
> > (bi_rw & REQ_FLUSH) set AND data to transfer.
> >
> > According to Documentation/block/writeback_cache_control.txt:
> >
> > The REQ_FLUSH flag can be OR ed into the r/w flags of a
> > bio submitted from the filesystem and will make sure the
> > volatile cache of the storage device has been flushed
> > before the actual I/O operation is started.
> >
> > So I've written code that handles that case, along with the
> > various error cases I might encounter, I think, which leads
> > to my question:
> >
> > How do I get such a bio with a data transfer AND the REQ_FLUSH bit
> > set to come into the driver? Just wondering how to test this case.
> >
> GFS2 does this... if you look at the log flush code and the function
> log_write_header() in particular, you'll see that it sets this on each
> log header that gets written. You don't need a cluster to generate this
> kind of i/o, just supply mkfs.gfs2 with -p lock_nolock and mount it as a
> local filesystem. The combination of touch foo; sync should be enough to
> generate a log flush writing a log header with this flag set,
Thanks!
Turns out ext3 seems to do it as well (now I feel kind of dumb
for asking -- had tried with ext2, and had tried some writes
with a file descriptor with O_SYNC set, but I was kind of shooting
in the dark.)
And my code appears to work too.
-- steve
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-08-09 20:34 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-09 19:09 Question about REQ_FLUSH and bios with data scameron
2013-08-09 19:11 ` scameron
2013-08-09 20:18 ` Steven Whitehouse
2013-08-09 20:34 ` scameron
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®