Skip to content

Commit a49d8d7

Browse files
SWaoterabhilashshetty04
authored andcommitted
bdev/crypto: support resize of base bdev
Add handling of SPDK_BDEV_EVENT_RESIZE event for crypto bdev. After obtaining it, resize crypto bdev to base bdev size and pass RESIZE event furter down the bdev stack. Fixes spdk#3549 Change-Id: Ie2827622e39f5ac820fa0372a36fd1a0377c9ebf Signed-off-by: Vasilii Ivanov <iwanovvvasilij@gmail.com> Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/25195 Reviewed-by: Jim Harris <jim.harris@samsung.com> Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com> Reviewed-by: Shuhei Matsumoto <smatsumoto@nvidia.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Community-CI: Mellanox Build Bot Community-CI: Community CI Samsung <spdk.community.ci.samsung@gmail.com> Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com> Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com> Signed-off-by: Abhilash Shetty <abhilash.shetty@datacore.com>
1 parent 4e0d622 commit a49d8d7

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

module/bdev/crypto/vbdev_crypto.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -701,6 +701,18 @@ vbdev_crypto_base_bdev_hotremove_cb(struct spdk_bdev *bdev_find)
701701
}
702702
}
703703

704+
static void
705+
vbdev_crypto_base_bdev_resize_cb(struct spdk_bdev *bdev_find)
706+
{
707+
struct vbdev_crypto *crypto_bdev;
708+
709+
TAILQ_FOREACH(crypto_bdev, &g_vbdev_crypto, link) {
710+
if (bdev_find == crypto_bdev->base_bdev) {
711+
spdk_bdev_notify_blockcnt_change(&crypto_bdev->crypto_bdev, bdev_find->blockcnt);
712+
}
713+
}
714+
}
715+
704716
/* Called when the underlying base bdev triggers asynchronous event such as bdev removal. */
705717
static void
706718
vbdev_crypto_base_bdev_event_cb(enum spdk_bdev_event_type type, struct spdk_bdev *bdev,
@@ -710,6 +722,9 @@ vbdev_crypto_base_bdev_event_cb(enum spdk_bdev_event_type type, struct spdk_bdev
710722
case SPDK_BDEV_EVENT_REMOVE:
711723
vbdev_crypto_base_bdev_hotremove_cb(bdev);
712724
break;
725+
case SPDK_BDEV_EVENT_RESIZE:
726+
vbdev_crypto_base_bdev_resize_cb(bdev);
727+
break;
713728
default:
714729
SPDK_NOTICELOG("Unsupported bdev event: type %d\n", type);
715730
break;

test/unit/lib/bdev/crypto.c/crypto_ut.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ DEFINE_STUB(spdk_bdev_get_memory_domains, int,
7777
DEFINE_STUB(spdk_accel_get_memory_domain, struct spdk_memory_domain *, (void), (void *)0xdeadbeef);
7878
DEFINE_STUB(spdk_accel_get_buf_align, uint8_t,
7979
(enum spdk_accel_opcode opcode, const struct spdk_accel_operation_exec_ctx *ctx), 0);
80+
DEFINE_STUB(spdk_bdev_notify_blockcnt_change, int, (struct spdk_bdev *bdev, uint64_t size), 0);
8081

8182
/* global vars and setup/cleanup functions used for all test functions */
8283
struct spdk_bdev_io *g_base_io;

0 commit comments

Comments
 (0)