[dm-devel] dm-bufio: prefetch
Mike Snitzer
snitzer at redhat.com
Tue Mar 13 13:00:44 UTC 2012
On Mon, Mar 12 2012 at 5:48pm -0400,
Mikulas Patocka <mpatocka at redhat.com> wrote:
> Hi
>
> This patch adds prefetch function to dm-bufio. I'm adding Joe to CC,
> because he may use it in his code too.
>
> Mikulas
>
> ---
>
> dm-bufio: prefetch
>
> This patch introduces a new function dm_bufio_prefetch. It prefetches
> the specified range of blocks into dm-bufio cache without waiting
> for i/o completion.
>
> Signed-off-by: Mikulas Patocka <mpatocka at redhat.com>
>
> ---
> drivers/md/dm-bufio.c | 88 +++++++++++++++++++++++++++++++++++++++-----------
> drivers/md/dm-bufio.h | 8 ++++
> 2 files changed, 77 insertions(+), 19 deletions(-)
>
> Index: linux-3.3-rc6-fast/drivers/md/dm-bufio.c
> ===================================================================
> --- linux-3.3-rc6-fast.orig/drivers/md/dm-bufio.c 2012-03-12 22:20:47.000000000 +0100
> +++ linux-3.3-rc6-fast/drivers/md/dm-bufio.c 2012-03-12 22:38:01.000000000 +0100
...
> @@ -1006,13 +1024,42 @@ void *dm_bufio_new(struct dm_bufio_clien
> }
> EXPORT_SYMBOL_GPL(dm_bufio_new);
>
> +void dm_bufio_prefetch(struct dm_bufio_client *c,
> + sector_t block, unsigned n_blocks)
> +{
> + struct blk_plug plug;
> +
> + blk_start_plug(&plug);
> + dm_bufio_lock(c);
> +
> + for (; n_blocks--; block++) {
> + int need_submit;
> + struct dm_buffer *b;
> + b = __bufio_new(c, block, NF_PREFETCH, &need_submit);
> + if (unlikely(b != NULL)) {
> + dm_bufio_unlock(c);
> +
> + if (need_submit)
> + submit_io(b, READ, b->block, read_endio);
> + dm_bufio_release(b);
> +
> + dm_bufio_cond_resched();
> + dm_bufio_lock(c);
> + }
> +
> + }
> +
> + dm_bufio_unlock(c);
> + blk_finish_plug(&plug);
> +}
> +EXPORT_SYMBOL(dm_bufio_prefetch);
Shouldn't this be EXPORT_SYMBOL_GPL (to match other bufio exports)?
More information about the dm-devel
mailing list