All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Snitzer <snitzer@redhat.com>
To: Mikulas Patocka <mpatocka@redhat.com>
Cc: dm-devel@redhat.com, "Alasdair G. Kergon" <agk@redhat.com>
Subject: Re: [PATCH 1/7] dm-bufio: return success or failure on prefetch
Date: Mon, 13 Jan 2014 16:21:17 -0500	[thread overview]
Message-ID: <20140113212116.GA3268@redhat.com> (raw)
In-Reply-To: <alpine.LRH.2.02.1401111228220.4018@file01.intranet.prod.int.rdu2.redhat.com>

On Sat, Jan 11 2014 at 12:29pm -0500,
Mikulas Patocka <mpatocka@redhat.com> wrote:

> This patch makes dm_bufio_prefetch return 1 on success and 0 on failure.
> A prefetch failure may happen in case of temporary memory shortage.
> 
> Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
> 
> ---
>  drivers/md/dm-bufio.c |    8 ++++++--
>  drivers/md/dm-bufio.h |    4 ++--
>  2 files changed, 8 insertions(+), 4 deletions(-)
> 
> Index: linux-3.13-rc7/drivers/md/dm-bufio.c
> ===================================================================
> --- linux-3.13-rc7.orig/drivers/md/dm-bufio.c	2014-01-09 16:11:31.000000000 +0100
> +++ linux-3.13-rc7/drivers/md/dm-bufio.c	2014-01-09 16:16:43.000000000 +0100
> @@ -1068,10 +1068,11 @@ void *dm_bufio_new(struct dm_bufio_clien
>  }
>  EXPORT_SYMBOL_GPL(dm_bufio_new);
>  
> -void dm_bufio_prefetch(struct dm_bufio_client *c,
> +int dm_bufio_prefetch(struct dm_bufio_client *c,
>  		       sector_t block, unsigned n_blocks)
>  {
>  	struct blk_plug plug;
> +	int success = 1;
>  
>  	LIST_HEAD(write_list);
>  

I'd prefer to see a bool used here.  Or an actual error code like
-ENOMEM.

> @@ -1104,13 +1105,16 @@ void dm_bufio_prefetch(struct dm_bufio_c
>  			if (!n_blocks)
>  				goto flush_plug;
>  			dm_bufio_lock(c);
> -		}
> +		} else
> +			success = 0;

Why do you continue to do work if a prefetch failed?  Why not return
early here?

  parent reply	other threads:[~2014-01-13 21:21 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-11 17:28 [PATCH 0/7] dm-snapshot prefetch patches Mikulas Patocka
2014-01-11 17:29 ` [PATCH 1/7] dm-bufio: return success or failure on prefetch Mikulas Patocka
2014-01-11 17:29   ` [PATCH 2/7] dm-bufio: introduce dm_bufio_forget Mikulas Patocka
2014-01-11 17:30     ` [PATCH 3/7] dm-bufio: introduce dm_bufio_set_minimum_buffers Mikulas Patocka
2014-01-11 17:30       ` [PATCH 4/7] dm-snapshot: use GFP_KERNEL when initializing the snapshot Mikulas Patocka
2014-01-11 17:30         ` [PATCH 5/7] dm-snapshot: make ps->area explicit Mikulas Patocka
2014-01-11 17:31           ` [PATCH 6/7] dm-snapshot: use dm-bufio Mikulas Patocka
2014-01-11 17:32             ` [PATCH 7/7] dm-snapshot: use bufio prefetch Mikulas Patocka
2014-01-13 21:27               ` Mike Snitzer
2014-01-13 22:03                 ` Mikulas Patocka
2014-01-13 21:37               ` [PATCH v2 7/7] dm snapshot: " Mike Snitzer
2014-01-13 22:00                 ` Mikulas Patocka
2014-01-13 22:56                   ` Mike Snitzer
2014-01-13 23:45                     ` Mikulas Patocka
2014-01-13 23:59                       ` Mike Snitzer
2014-01-14  0:11                         ` Mikulas Patocka
2014-01-13 21:21   ` Mike Snitzer [this message]
2014-01-14  0:11     ` [PATCH 1/7] dm-bufio: return success or failure on prefetch Mikulas Patocka

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=20140113212116.GA3268@redhat.com \
    --to=snitzer@redhat.com \
    --cc=agk@redhat.com \
    --cc=dm-devel@redhat.com \
    --cc=mpatocka@redhat.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.