Commit 687cfd4b authored by Artur Paszkiewicz's avatar Artur Paszkiewicz Committed by Jim Harris
Browse files

bdev: pass the range in lba range lock callback



This will be used by the following patch adding bdev quiesce API.

Change-Id: I636aaf47b79755c60c181f12b876a8c8a5a24a7b
Signed-off-by: default avatarArtur Paszkiewicz <artur.paszkiewicz@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/18099


Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
parent d0eef162
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -128,7 +128,7 @@ _bdev_init(void)
	spdk_spin_init(&g_bdev_mgr.spinlock);
}

typedef void (*lock_range_cb)(void *ctx, int status);
typedef void (*lock_range_cb)(struct lba_range *range, void *ctx, int status);

typedef void (*bdev_copy_bounce_buffer_cpl)(void *ctx, int rc);

@@ -5749,7 +5749,7 @@ spdk_bdev_compare_blocks_with_md(struct spdk_bdev_desc *desc, struct spdk_io_cha
}

static void
bdev_comparev_and_writev_blocks_unlocked(void *ctx, int unlock_status)
bdev_comparev_and_writev_blocks_unlocked(struct lba_range *range, void *ctx, int unlock_status)
{
	struct spdk_bdev_io *bdev_io = ctx;

@@ -5840,7 +5840,7 @@ bdev_compare_and_write_do_compare(void *_bdev_io)
}

static void
bdev_comparev_and_writev_blocks_locked(void *ctx, int status)
bdev_comparev_and_writev_blocks_locked(struct lba_range *range, void *ctx, int status)
{
	struct spdk_bdev_io *bdev_io = ctx;

@@ -9169,7 +9169,7 @@ bdev_lock_error_cleanup_cb(struct spdk_bdev *bdev, void *_ctx, int status)
{
	struct locked_lba_range_ctx *ctx = _ctx;

	ctx->cb_fn(ctx->cb_arg, -ENOMEM);
	ctx->cb_fn(&ctx->range, ctx->cb_arg, -ENOMEM);
	free(ctx);
}

@@ -9202,7 +9202,7 @@ bdev_lock_lba_range_cb(struct spdk_bdev *bdev, void *_ctx, int status)
		ctx->owner_range->owner_ch = ctx->range.owner_ch;
	}

	ctx->cb_fn(ctx->cb_arg, status);
	ctx->cb_fn(&ctx->range, ctx->cb_arg, status);

	/* Don't free the ctx here.  Its range is in the bdev's global list of
	 * locked ranges still, and will be removed and freed when this range
@@ -9392,7 +9392,7 @@ bdev_unlock_lba_range_cb(struct spdk_bdev *bdev, void *_ctx, int status)
	}
	spdk_spin_unlock(&bdev->internal.spinlock);

	ctx->cb_fn(ctx->cb_arg, status);
	ctx->cb_fn(&ctx->range, ctx->cb_arg, status);
	free(ctx);
}

+2 −2
Original line number Diff line number Diff line
@@ -4740,13 +4740,13 @@ static bool g_lock_lba_range_done;
static bool g_unlock_lba_range_done;

static void
lock_lba_range_done(void *ctx, int status)
lock_lba_range_done(struct lba_range *range, void *ctx, int status)
{
	g_lock_lba_range_done = true;
}

static void
unlock_lba_range_done(void *ctx, int status)
unlock_lba_range_done(struct lba_range *range, void *ctx, int status)
{
	g_unlock_lba_range_done = true;
}
+2 −2
Original line number Diff line number Diff line
@@ -2156,13 +2156,13 @@ io_done2(struct spdk_bdev_io *bdev_io, bool success, void *cb_arg)
}

static void
lock_lba_range_done(void *ctx, int status)
lock_lba_range_done(struct lba_range *range, void *ctx, int status)
{
	g_lock_lba_range_done = true;
}

static void
unlock_lba_range_done(void *ctx, int status)
unlock_lba_range_done(struct lba_range *range, void *ctx, int status)
{
	g_unlock_lba_range_done = true;
}