2019-07-02 14:31:58

by Hou Tao

[permalink] [raw]
Subject: [PATCH] raid1: use an int as the return value of raise_barrier()

Using a sector_t as the return value is misleading, because
raise_barrier() only return 0 or -EINTR.

Also add comments for the return values of raise_barrier().

Signed-off-by: Hou Tao <[email protected]>
---
drivers/md/raid1.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index da06bb47195b..c1ea5e0c3cf6 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -846,8 +846,10 @@ static void flush_pending_writes(struct r1conf *conf)
* backgroup IO calls must call raise_barrier. Once that returns
* there is no normal IO happeing. It must arrange to call
* lower_barrier when the particular background IO completes.
+ *
+ * Will return -EINTR if resync/recovery is interrupted, else return 0.
*/
-static sector_t raise_barrier(struct r1conf *conf, sector_t sector_nr)
+static int raise_barrier(struct r1conf *conf, sector_t sector_nr)
{
int idx = sector_to_idx(sector_nr);

--
2.22.0


2019-07-23 03:36:01

by Song Liu

[permalink] [raw]
Subject: Re: [PATCH] raid1: use an int as the return value of raise_barrier()

On Tue, Jul 2, 2019 at 7:30 AM Hou Tao <[email protected]> wrote:
>
> Using a sector_t as the return value is misleading, because
> raise_barrier() only return 0 or -EINTR.
>
> Also add comments for the return values of raise_barrier().
>
> Signed-off-by: Hou Tao <[email protected]>

Applied. Thanks for the patch.

Song