Adapt to backported kernel changes and function deprecations.
Resolves: RHEL-35753 Signed-off-by: Susan LeGendre-McGhee <slegendr@redhat.com>
This commit is contained in:
parent
b1eb9f3644
commit
d347407f37
1
.gitignore
vendored
1
.gitignore
vendored
@ -11,3 +11,4 @@
|
||||
/kvdo-e2a5ebb.tar.gz
|
||||
/kvdo-c9bd224.tar.gz
|
||||
/kvdo-c6254c6.tar.gz
|
||||
/kvdo-9b37ab4.tar.gz
|
||||
|
@ -1,12 +1,13 @@
|
||||
%global commit c6254c6db5cfa02ecf5bbb4db2c5728f23aa3b2a
|
||||
%global gittag 8.2.3.3
|
||||
%global commit 9b37ab403fd4d145943180ec05039760e3a9e4db
|
||||
%global gittag 8.2.4.10
|
||||
%global shortcommit %(c=%{commit}; echo ${c:0:7})
|
||||
%define spec_release 129
|
||||
%define spec_release 130
|
||||
|
||||
%define kmod_name kvdo
|
||||
%define kmod_driver_version %{gittag}
|
||||
%define kmod_rpm_release %{spec_release}
|
||||
%define kmod_kernel_version 5.14.0-460.el9
|
||||
%define kmod_kernel_extra %(sed 's/.*-\\([0-9]\\+\\).*/\\1/' <<< "%{kmod_kernel_version}")
|
||||
%define kmod_headers_version %(rpm -qa kernel-devel | sed 's/^kernel-devel-//')
|
||||
%define kmod_kbuild_dir .
|
||||
%define kmod_devel_package 0
|
||||
@ -14,7 +15,6 @@
|
||||
Source0: https://github.com/dm-vdo/%{kmod_name}/archive/%{commit}/%{kmod_name}-%{shortcommit}.tar.gz
|
||||
Patch0: add_lz4_dependency.patch
|
||||
Patch1: removed-logical-space-check-from-table-line.patch
|
||||
Patch2: use_vdo_target_block_device.patch
|
||||
|
||||
%define findpat %( echo "%""P" )
|
||||
|
||||
@ -109,7 +109,6 @@ printf '%s\n' "${modules[@]}" | %{_sbindir}/weak-modules --dracut=/usr/bin/dracu
|
||||
%setup -n %{kmod_name}-%{commit}
|
||||
%patch0 -p1
|
||||
%patch1 -p1
|
||||
%patch2 -p1
|
||||
%{nil}
|
||||
set -- *
|
||||
mkdir source
|
||||
@ -120,7 +119,8 @@ mkdir obj
|
||||
rm -rf obj
|
||||
cp -r source obj
|
||||
make -C %{kernel_source} M=$PWD/obj/%{kmod_kbuild_dir} V=1 \
|
||||
NOSTDINC_FLAGS="-I $PWD/obj/include -I $PWD/obj/include/uapi"
|
||||
NOSTDINC_FLAGS="-I $PWD/obj/include -I $PWD/obj/include/uapi" \
|
||||
RHEL_RELEASE_EXTRA=%{kmod_kernel_extra}
|
||||
# mark modules executable so that strip-to-file can strip them
|
||||
find obj/%{kmod_kbuild_dir} -name "*.ko" -type f -exec chmod u+x '{}' +
|
||||
|
||||
@ -158,6 +158,10 @@ install -m 644 -D source/greylist.txt $RPM_BUILD_ROOT/usr/share/doc/kmod-%{kmod_
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
|
||||
%changelog
|
||||
* Fri Jun 14 2024 - Susan LeGendre-McGhee <slegendr@redhat.com> - 8.2.4.10-130.el9
|
||||
- Adapt to backported kernel changes and function deprecations.
|
||||
- Resolves: RHEL-35753
|
||||
|
||||
* Wed Jun 12 2024 - Chung Chung <cchung@redhat.com> - 8.2.3.3-129.el9
|
||||
- Rebuilt for latest kernel.
|
||||
- Related: RHEL-30884
|
||||
|
2
sources
2
sources
@ -1 +1 @@
|
||||
SHA512 (kvdo-c6254c6.tar.gz) = 262fb5f8b6b4ca31e06b4816b41a225a05a8058d77dd72fb6b93f32352697487e4120876698bba76bf3cf899ce2db7ad83bd4aa09b1067ea8aec50fc2c9545d6
|
||||
SHA512 (kvdo-9b37ab4.tar.gz) = 03b61449402623628e29d5f709d865c60155db55a43e4fb361ff51cf768e0224da60ab85b4d343effc86d1fef27de3213c273b698af0f07fd2f913f2ecd349d1
|
||||
|
@ -1,510 +0,0 @@
|
||||
diff -Naur kvdo-c6254c6db5cfa02ecf5bbb4db2c5728f23aa3b2a.orig/vdo/config.c kvdo-c6254c6db5cfa02ecf5bbb4db2c5728f23aa3b2a/vdo/config.c
|
||||
--- kvdo-c6254c6db5cfa02ecf5bbb4db2c5728f23aa3b2a.orig/vdo/config.c 2023-10-19 18:57:25.000000000 -0400
|
||||
+++ kvdo-c6254c6db5cfa02ecf5bbb4db2c5728f23aa3b2a/vdo/config.c 2024-05-07 09:38:49.210509205 -0400
|
||||
@@ -676,7 +676,7 @@
|
||||
config->sparse_sample_rate =
|
||||
(params->sparse ? DEFAULT_SPARSE_SAMPLE_RATE : 0);
|
||||
config->nonce = params->nonce;
|
||||
- config->name = params->name;
|
||||
+ config->bdev = params->bdev;
|
||||
config->offset = params->offset;
|
||||
config->size = params->size;
|
||||
|
||||
diff -Naur kvdo-c6254c6db5cfa02ecf5bbb4db2c5728f23aa3b2a.orig/vdo/config.h kvdo-c6254c6db5cfa02ecf5bbb4db2c5728f23aa3b2a/vdo/config.h
|
||||
--- kvdo-c6254c6db5cfa02ecf5bbb4db2c5728f23aa3b2a.orig/vdo/config.h 2023-10-19 18:57:25.000000000 -0400
|
||||
+++ kvdo-c6254c6db5cfa02ecf5bbb4db2c5728f23aa3b2a/vdo/config.h 2024-05-07 09:38:49.210509205 -0400
|
||||
@@ -20,8 +20,8 @@
|
||||
|
||||
/* A set of configuration parameters for the indexer. */
|
||||
struct configuration {
|
||||
- /* String describing the storage device */
|
||||
- const char *name;
|
||||
+ /* Storage device for the index */
|
||||
+ struct block_device *bdev;
|
||||
|
||||
/* The maximum allowable size of the index */
|
||||
size_t size;
|
||||
diff -Naur kvdo-c6254c6db5cfa02ecf5bbb4db2c5728f23aa3b2a.orig/vdo/dedupe.c kvdo-c6254c6db5cfa02ecf5bbb4db2c5728f23aa3b2a/vdo/dedupe.c
|
||||
--- kvdo-c6254c6db5cfa02ecf5bbb4db2c5728f23aa3b2a.orig/vdo/dedupe.c 2023-10-19 18:57:25.000000000 -0400
|
||||
+++ kvdo-c6254c6db5cfa02ecf5bbb4db2c5728f23aa3b2a/vdo/dedupe.c 2024-05-07 09:38:49.210509205 -0400
|
||||
@@ -2796,7 +2796,7 @@
|
||||
uds_offset = ((vdo_get_index_region_start(geometry) -
|
||||
geometry.bio_offset) * VDO_BLOCK_SIZE);
|
||||
zones->parameters = (struct uds_parameters) {
|
||||
- .name = vdo->device_config->parent_device_name,
|
||||
+ .bdev = vdo->device_config->owned_device->bdev,
|
||||
.offset = uds_offset,
|
||||
.size = (vdo_get_index_region_size(geometry) * VDO_BLOCK_SIZE),
|
||||
.memory_size = geometry.index_config.mem,
|
||||
@@ -3269,9 +3269,9 @@
|
||||
struct device_config *config = parent->vdo->device_config;
|
||||
int result;
|
||||
|
||||
- zones->parameters.name = config->parent_device_name;
|
||||
+ zones->parameters.bdev = config->owned_device->bdev;
|
||||
result = uds_resume_index_session(zones->index_session,
|
||||
- zones->parameters.name);
|
||||
+ zones->parameters.bdev);
|
||||
if (result != UDS_SUCCESS) {
|
||||
uds_log_error_strerror(result, "Error resuming dedupe index");
|
||||
}
|
||||
diff -Naur kvdo-c6254c6db5cfa02ecf5bbb4db2c5728f23aa3b2a.orig/vdo/index.c kvdo-c6254c6db5cfa02ecf5bbb4db2c5728f23aa3b2a/vdo/index.c
|
||||
--- kvdo-c6254c6db5cfa02ecf5bbb4db2c5728f23aa3b2a.orig/vdo/index.c 2023-10-19 18:57:25.000000000 -0400
|
||||
+++ kvdo-c6254c6db5cfa02ecf5bbb4db2c5728f23aa3b2a/vdo/index.c 2024-05-07 09:38:49.211509205 -0400
|
||||
@@ -1557,9 +1557,9 @@
|
||||
return result;
|
||||
}
|
||||
|
||||
-int replace_index_storage(struct uds_index *index, const char *path)
|
||||
+int replace_index_storage(struct uds_index *index, struct block_device *bdev)
|
||||
{
|
||||
- return replace_volume_storage(index->volume, index->layout, path);
|
||||
+ return replace_volume_storage(index->volume, index->layout, bdev);
|
||||
}
|
||||
|
||||
/* Accessing statistics should be safe from any thread. */
|
||||
diff -Naur kvdo-c6254c6db5cfa02ecf5bbb4db2c5728f23aa3b2a.orig/vdo/index.h kvdo-c6254c6db5cfa02ecf5bbb4db2c5728f23aa3b2a/vdo/index.h
|
||||
--- kvdo-c6254c6db5cfa02ecf5bbb4db2c5728f23aa3b2a.orig/vdo/index.h 2023-10-19 18:57:25.000000000 -0400
|
||||
+++ kvdo-c6254c6db5cfa02ecf5bbb4db2c5728f23aa3b2a/vdo/index.h 2024-05-07 09:38:49.211509205 -0400
|
||||
@@ -63,7 +63,7 @@
|
||||
void free_index(struct uds_index *index);
|
||||
|
||||
int __must_check replace_index_storage(struct uds_index *index,
|
||||
- const char *path);
|
||||
+ struct block_device *bdev);
|
||||
|
||||
void get_index_stats(struct uds_index *index,
|
||||
struct uds_index_stats *counters);
|
||||
diff -Naur kvdo-c6254c6db5cfa02ecf5bbb4db2c5728f23aa3b2a.orig/vdo/index-layout.c kvdo-c6254c6db5cfa02ecf5bbb4db2c5728f23aa3b2a/vdo/index-layout.c
|
||||
--- kvdo-c6254c6db5cfa02ecf5bbb4db2c5728f23aa3b2a.orig/vdo/index-layout.c 2023-10-19 18:57:25.000000000 -0400
|
||||
+++ kvdo-c6254c6db5cfa02ecf5bbb4db2c5728f23aa3b2a/vdo/index-layout.c 2024-05-07 09:38:49.211509205 -0400
|
||||
@@ -1980,7 +1980,7 @@
|
||||
size_t writable_size;
|
||||
struct io_factory *factory = NULL;
|
||||
|
||||
- result = make_uds_io_factory(config->name, &factory);
|
||||
+ result = make_uds_io_factory(config->bdev, &factory);
|
||||
if (result != UDS_SUCCESS) {
|
||||
return result;
|
||||
}
|
||||
@@ -2062,9 +2062,9 @@
|
||||
}
|
||||
|
||||
int replace_index_layout_storage(struct index_layout *layout,
|
||||
- const char *name)
|
||||
+ struct block_device *bdev)
|
||||
{
|
||||
- return replace_uds_storage(layout->factory, name);
|
||||
+ return replace_uds_storage(layout->factory, bdev);
|
||||
}
|
||||
|
||||
/* Obtain a dm_bufio_client for the volume region. */
|
||||
diff -Naur kvdo-c6254c6db5cfa02ecf5bbb4db2c5728f23aa3b2a.orig/vdo/index-layout.h kvdo-c6254c6db5cfa02ecf5bbb4db2c5728f23aa3b2a/vdo/index-layout.h
|
||||
--- kvdo-c6254c6db5cfa02ecf5bbb4db2c5728f23aa3b2a.orig/vdo/index-layout.h 2023-10-19 18:57:25.000000000 -0400
|
||||
+++ kvdo-c6254c6db5cfa02ecf5bbb4db2c5728f23aa3b2a/vdo/index-layout.h 2024-05-07 09:38:49.211509205 -0400
|
||||
@@ -20,7 +20,7 @@
|
||||
void free_uds_index_layout(struct index_layout *layout);
|
||||
|
||||
int __must_check replace_index_layout_storage(struct index_layout *layout,
|
||||
- const char *name);
|
||||
+ struct block_device *bdev);
|
||||
|
||||
int __must_check load_index_state(struct index_layout *layout,
|
||||
struct uds_index *index);
|
||||
diff -Naur kvdo-c6254c6db5cfa02ecf5bbb4db2c5728f23aa3b2a.orig/vdo/index-session.c kvdo-c6254c6db5cfa02ecf5bbb4db2c5728f23aa3b2a/vdo/index-session.c
|
||||
--- kvdo-c6254c6db5cfa02ecf5bbb4db2c5728f23aa3b2a.orig/vdo/index-session.c 2023-10-19 18:57:25.000000000 -0400
|
||||
+++ kvdo-c6254c6db5cfa02ecf5bbb4db2c5728f23aa3b2a/vdo/index-session.c 2024-05-07 09:42:15.007509205 -0400
|
||||
@@ -389,13 +389,14 @@
|
||||
struct uds_index_session *session)
|
||||
{
|
||||
int result;
|
||||
+ char name[BDEVNAME_SIZE];
|
||||
|
||||
if (parameters == NULL) {
|
||||
uds_log_error("missing required parameters");
|
||||
return -EINVAL;
|
||||
}
|
||||
- if (parameters->name == NULL) {
|
||||
- uds_log_error("missing required index name");
|
||||
+ if (parameters->bdev == NULL) {
|
||||
+ uds_log_error("missing required block device");
|
||||
return -EINVAL;
|
||||
}
|
||||
if (session == NULL) {
|
||||
@@ -408,31 +409,9 @@
|
||||
return uds_map_to_system_error(result);
|
||||
}
|
||||
|
||||
- if ((session->parameters.name == NULL) ||
|
||||
- (strcmp(parameters->name, session->parameters.name) != 0)) {
|
||||
- char *new_name;
|
||||
-
|
||||
- result = uds_duplicate_string(parameters->name,
|
||||
- "device name",
|
||||
- &new_name);
|
||||
- if (result != UDS_SUCCESS) {
|
||||
- finish_loading_index_session(session, result);
|
||||
- return uds_map_to_system_error(result);
|
||||
- }
|
||||
-
|
||||
- uds_free_const(session->parameters.name);
|
||||
- session->parameters = *parameters;
|
||||
- session->parameters.name = new_name;
|
||||
- } else {
|
||||
- const char *old_name = session->parameters.name;
|
||||
-
|
||||
- session->parameters = *parameters;
|
||||
- session->parameters.name = old_name;
|
||||
- }
|
||||
-
|
||||
- uds_log_notice("%s: %s",
|
||||
- get_open_type_string(open_type),
|
||||
- parameters->name);
|
||||
+ session->parameters = *parameters;
|
||||
+ format_dev_t(name, parameters->bdev->bd_dev);
|
||||
+ uds_log_notice("%s: %s", get_open_type_string(open_type), name);
|
||||
result = initialize_index_session(session, open_type);
|
||||
if (result != UDS_SUCCESS) {
|
||||
uds_log_error_strerror(result,
|
||||
@@ -550,34 +529,26 @@
|
||||
}
|
||||
|
||||
static int replace_device(struct uds_index_session *session,
|
||||
- const char *name)
|
||||
+ struct block_device *bdev)
|
||||
{
|
||||
int result;
|
||||
- char *new_name;
|
||||
|
||||
- result = uds_duplicate_string(name, "device name", &new_name);
|
||||
+ result = replace_index_storage(session->index, bdev);
|
||||
if (result != UDS_SUCCESS) {
|
||||
return result;
|
||||
}
|
||||
|
||||
- result = replace_index_storage(session->index, name);
|
||||
- if (result != UDS_SUCCESS) {
|
||||
- UDS_FREE(new_name);
|
||||
- return result;
|
||||
- }
|
||||
-
|
||||
- uds_free_const(session->parameters.name);
|
||||
- session->parameters.name = new_name;
|
||||
+ session->parameters.bdev = bdev;
|
||||
return UDS_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
* Resume index operation after being suspended. If the index is suspended
|
||||
- * and the supplied name is different from the current backing store, the
|
||||
+ * and the supplied block device differs from the current backing store, the
|
||||
* index will start using the new backing store.
|
||||
*/
|
||||
int uds_resume_index_session(struct uds_index_session *session,
|
||||
- const char *name)
|
||||
+ struct block_device *bdev)
|
||||
{
|
||||
int result = UDS_SUCCESS;
|
||||
bool no_work = false;
|
||||
@@ -604,9 +575,9 @@
|
||||
return result;
|
||||
}
|
||||
|
||||
- if ((name != NULL) && (session->index != NULL) &&
|
||||
- (strcmp(name, session->parameters.name) != 0)) {
|
||||
- result = replace_device(session, name);
|
||||
+ if ((bdev != NULL) && (session->index != NULL) &&
|
||||
+ (bdev != session->parameters.bdev)) {
|
||||
+ result = replace_device(session, bdev);
|
||||
if (result != UDS_SUCCESS) {
|
||||
uds_lock_mutex(&session->request_mutex);
|
||||
session->state &= ~IS_FLAG_WAITING;
|
||||
@@ -780,7 +751,6 @@
|
||||
|
||||
wait_for_no_requests_in_progress(index_session);
|
||||
result = save_and_free_index(index_session);
|
||||
- uds_free_const(index_session->parameters.name);
|
||||
uds_request_queue_finish(index_session->callback_queue);
|
||||
index_session->callback_queue = NULL;
|
||||
uds_destroy_cond(&index_session->load_context.cond);
|
||||
@@ -808,35 +778,12 @@
|
||||
struct uds_parameters **parameters)
|
||||
{
|
||||
int result;
|
||||
- const char *name = index_session->parameters.name;
|
||||
|
||||
if (parameters == NULL) {
|
||||
uds_log_error("received a NULL parameters pointer");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
- if (name != NULL) {
|
||||
- char *name_copy = NULL;
|
||||
- size_t name_length = strlen(name) + 1;
|
||||
- struct uds_parameters *copy;
|
||||
-
|
||||
- result = UDS_ALLOCATE_EXTENDED(struct uds_parameters,
|
||||
- name_length,
|
||||
- char,
|
||||
- __func__,
|
||||
- ©);
|
||||
- if (result != UDS_SUCCESS) {
|
||||
- return uds_map_to_system_error(result);
|
||||
- }
|
||||
-
|
||||
- *copy = index_session->parameters;
|
||||
- name_copy = (char *) copy + sizeof(struct uds_parameters);
|
||||
- memcpy(name_copy, name, name_length);
|
||||
- copy->name = name_copy;
|
||||
- *parameters = copy;
|
||||
- return UDS_SUCCESS;
|
||||
- }
|
||||
-
|
||||
result = UDS_ALLOCATE(1, struct uds_parameters, __func__, parameters);
|
||||
if (result == UDS_SUCCESS) {
|
||||
**parameters = index_session->parameters;
|
||||
diff -Naur kvdo-c6254c6db5cfa02ecf5bbb4db2c5728f23aa3b2a.orig/vdo/io-factory.c kvdo-c6254c6db5cfa02ecf5bbb4db2c5728f23aa3b2a/vdo/io-factory.c
|
||||
--- kvdo-c6254c6db5cfa02ecf5bbb4db2c5728f23aa3b2a.orig/vdo/io-factory.c 2023-10-19 18:57:25.000000000 -0400
|
||||
+++ kvdo-c6254c6db5cfa02ecf5bbb4db2c5728f23aa3b2a/vdo/io-factory.c 2024-05-07 09:38:49.212509205 -0400
|
||||
@@ -6,27 +6,10 @@
|
||||
#include <linux/atomic.h>
|
||||
#include <linux/blkdev.h>
|
||||
#include <linux/mount.h>
|
||||
-#ifndef VDO_UPSTREAM
|
||||
-#include <linux/version.h>
|
||||
-#endif /* VDO_UPSTREAM */
|
||||
|
||||
#include "io-factory.h"
|
||||
#include "logger.h"
|
||||
#include "memory-alloc.h"
|
||||
-#ifndef VDO_UPSTREAM
|
||||
-#undef VDO_USE_ALTERNATE
|
||||
-#ifdef RHEL_RELEASE_CODE
|
||||
-#if (RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(9, 4))
|
||||
-#define VDO_USE_ALTERNATE
|
||||
-#endif
|
||||
-#else /* !RHEL_RELEASE_CODE */
|
||||
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(6,5,0))
|
||||
-#define VDO_USE_ALTERNATE
|
||||
-#endif
|
||||
-#endif /* !RHEL_RELEASE_CODE */
|
||||
-#endif /* !VDO_UPSTREAM */
|
||||
-
|
||||
-enum { BLK_FMODE = FMODE_READ | FMODE_WRITE };
|
||||
|
||||
/*
|
||||
* A kernel mode IO Factory object controls access to an index stored
|
||||
@@ -42,67 +25,14 @@
|
||||
atomic_inc(&factory->ref_count);
|
||||
}
|
||||
|
||||
-static int get_block_device_from_name(const char *name,
|
||||
- struct block_device **bdev)
|
||||
-{
|
||||
- dev_t device;
|
||||
- unsigned int major, minor;
|
||||
- char dummy;
|
||||
-#ifndef VDO_USE_ALTERNATE
|
||||
- const struct blk_holder_ops hops = { NULL };
|
||||
-#endif /* !VDO_USE_ALTERNATE */
|
||||
-
|
||||
- /* Extract the major/minor numbers */
|
||||
- if (sscanf(name, "%u:%u%c", &major, &minor, &dummy) == 2) {
|
||||
- device = MKDEV(major, minor);
|
||||
- if (MAJOR(device) != major || MINOR(device) != minor) {
|
||||
- *bdev = NULL;
|
||||
- return uds_log_error_strerror(UDS_INVALID_ARGUMENT,
|
||||
- "%s is not a valid block device",
|
||||
- name);
|
||||
- }
|
||||
-#ifdef VDO_USE_ALTERNATE
|
||||
- *bdev = blkdev_get_by_dev(device, BLK_FMODE, NULL);
|
||||
-#else
|
||||
- *bdev = blkdev_get_by_dev(device, BLK_FMODE, NULL, &hops);
|
||||
-#endif /* VDO_USE_ALTERNATE */
|
||||
- } else {
|
||||
-#ifdef VDO_USE_ALTERNATE
|
||||
- *bdev = blkdev_get_by_path(name, BLK_FMODE, NULL);
|
||||
-#else
|
||||
- *bdev = blkdev_get_by_path(name, BLK_FMODE, NULL, &hops);
|
||||
-#endif /* VDO_USE_ALTERNATE */
|
||||
- }
|
||||
-
|
||||
- if (IS_ERR(*bdev)) {
|
||||
- uds_log_error_strerror(-PTR_ERR(*bdev), "%s is not a block device", name);
|
||||
- *bdev = NULL;
|
||||
- return UDS_INVALID_ARGUMENT;
|
||||
- }
|
||||
-
|
||||
- return UDS_SUCCESS;
|
||||
-}
|
||||
-
|
||||
-int make_uds_io_factory(const char *path, struct io_factory **factory_ptr)
|
||||
+int make_uds_io_factory(struct block_device *bdev, struct io_factory **factory_ptr)
|
||||
{
|
||||
int result;
|
||||
- struct block_device *bdev;
|
||||
struct io_factory *factory;
|
||||
|
||||
- result = get_block_device_from_name(path, &bdev);
|
||||
- if (result != UDS_SUCCESS) {
|
||||
- return result;
|
||||
- }
|
||||
-
|
||||
result = UDS_ALLOCATE(1, struct io_factory, __func__, &factory);
|
||||
- if (result != UDS_SUCCESS) {
|
||||
-#ifdef VDO_USE_ALTERNATE
|
||||
- blkdev_put(bdev, BLK_FMODE);
|
||||
-#else
|
||||
- blkdev_put(bdev, NULL);
|
||||
-#endif /* VDO_USE_ALTERNATE */
|
||||
+ if (result != UDS_SUCCESS)
|
||||
return result;
|
||||
- }
|
||||
|
||||
factory->bdev = bdev;
|
||||
atomic_set_release(&factory->ref_count, 1);
|
||||
@@ -111,35 +41,16 @@
|
||||
return UDS_SUCCESS;
|
||||
}
|
||||
|
||||
-int replace_uds_storage(struct io_factory *factory, const char *path)
|
||||
+int replace_uds_storage(struct io_factory *factory, struct block_device *bdev)
|
||||
{
|
||||
- int result;
|
||||
- struct block_device *bdev;
|
||||
-
|
||||
- result = get_block_device_from_name(path, &bdev);
|
||||
- if (result != UDS_SUCCESS) {
|
||||
- return result;
|
||||
- }
|
||||
-
|
||||
-#ifdef VDO_USE_ALTERNATE
|
||||
- blkdev_put(factory->bdev, BLK_FMODE);
|
||||
-#else
|
||||
- blkdev_put(factory->bdev, NULL);
|
||||
-#endif /* VDO_USE_ALTERNATE */
|
||||
factory->bdev = bdev;
|
||||
return UDS_SUCCESS;
|
||||
}
|
||||
|
||||
void put_uds_io_factory(struct io_factory *factory)
|
||||
{
|
||||
- if (atomic_add_return(-1, &factory->ref_count) <= 0) {
|
||||
-#ifdef VDO_USE_ALTERNATE
|
||||
- blkdev_put(factory->bdev, BLK_FMODE);
|
||||
-#else
|
||||
- blkdev_put(factory->bdev, NULL);
|
||||
-#endif /* VDO_USE_ALTERNATE */
|
||||
+ if (atomic_add_return(-1, &factory->ref_count) <= 0)
|
||||
UDS_FREE(factory);
|
||||
- }
|
||||
}
|
||||
|
||||
size_t get_uds_writable_size(struct io_factory *factory)
|
||||
diff -Naur kvdo-c6254c6db5cfa02ecf5bbb4db2c5728f23aa3b2a.orig/vdo/io-factory.h kvdo-c6254c6db5cfa02ecf5bbb4db2c5728f23aa3b2a/vdo/io-factory.h
|
||||
--- kvdo-c6254c6db5cfa02ecf5bbb4db2c5728f23aa3b2a.orig/vdo/io-factory.h 2023-10-19 18:57:25.000000000 -0400
|
||||
+++ kvdo-c6254c6db5cfa02ecf5bbb4db2c5728f23aa3b2a/vdo/io-factory.h 2024-05-07 09:38:49.212509205 -0400
|
||||
@@ -36,25 +36,24 @@
|
||||
* Create an IO factory. The IO factory is returned with a reference
|
||||
* count of 1.
|
||||
*
|
||||
- * @param path The path to the block device or file that contains the
|
||||
- * block stream
|
||||
+ * @param bdev The block device that contains the block stream
|
||||
* @param factory_ptr The IO factory is returned here
|
||||
*
|
||||
* @return UDS_SUCCESS or an error code
|
||||
**/
|
||||
-int __must_check make_uds_io_factory(const char *path,
|
||||
+int __must_check make_uds_io_factory(struct block_device *bdev,
|
||||
struct io_factory **factory_ptr);
|
||||
|
||||
/**
|
||||
* Replace the backing store for an IO factory.
|
||||
*
|
||||
* @param factory The IO factory
|
||||
- * @param path The path to the new block device or storage file
|
||||
+ * @param bdev The new block device
|
||||
*
|
||||
* @return UDS_SUCCESS or an error code
|
||||
**/
|
||||
int __must_check replace_uds_storage(struct io_factory *factory,
|
||||
- const char *path);
|
||||
+ struct block_device *bdev);
|
||||
|
||||
/**
|
||||
* Get another reference to an IO factory, incrementing its reference count.
|
||||
diff -Naur kvdo-c6254c6db5cfa02ecf5bbb4db2c5728f23aa3b2a.orig/vdo/uds.h kvdo-c6254c6db5cfa02ecf5bbb4db2c5728f23aa3b2a/vdo/uds.h
|
||||
--- kvdo-c6254c6db5cfa02ecf5bbb4db2c5728f23aa3b2a.orig/vdo/uds.h 2023-10-19 18:57:25.000000000 -0400
|
||||
+++ kvdo-c6254c6db5cfa02ecf5bbb4db2c5728f23aa3b2a/vdo/uds.h 2024-05-07 09:38:49.214509205 -0400
|
||||
@@ -132,8 +132,8 @@
|
||||
* The data used to configure a new index.
|
||||
**/
|
||||
struct uds_parameters {
|
||||
- /** String describing the storage device */
|
||||
- const char *name;
|
||||
+ /** The block_device used for storage */
|
||||
+ struct block_device *bdev;
|
||||
/** The maximum allowable size of the index on storage */
|
||||
size_t size;
|
||||
/** The offset where the index should start */
|
||||
@@ -404,9 +404,10 @@
|
||||
bool save);
|
||||
|
||||
/**
|
||||
- * Allows new index operations for an index, whether it was suspended or not.
|
||||
- * If the index is suspended and the supplied path is different from the
|
||||
- * current backing store, the index will start using the new backing store.
|
||||
+ * Allow new index operations for an index, whether it was suspended or not.
|
||||
+ * If the index is suspended and the supplied block device differs from the
|
||||
+ * current backing store, the index will start using the new backing store
|
||||
+ * instead.
|
||||
*
|
||||
* @param session The session to resume
|
||||
* @param name A name describing the new backing store to use
|
||||
@@ -414,7 +415,7 @@
|
||||
* @return Either #UDS_SUCCESS or an error code
|
||||
**/
|
||||
int __must_check uds_resume_index_session(struct uds_index_session *session,
|
||||
- const char *name);
|
||||
+ struct block_device *bdev);
|
||||
|
||||
/**
|
||||
* Waits until all callbacks for index operations are complete.
|
||||
diff -Naur kvdo-c6254c6db5cfa02ecf5bbb4db2c5728f23aa3b2a.orig/vdo/volume.c kvdo-c6254c6db5cfa02ecf5bbb4db2c5728f23aa3b2a/vdo/volume.c
|
||||
--- kvdo-c6254c6db5cfa02ecf5bbb4db2c5728f23aa3b2a.orig/vdo/volume.c 2023-10-19 18:57:25.000000000 -0400
|
||||
+++ kvdo-c6254c6db5cfa02ecf5bbb4db2c5728f23aa3b2a/vdo/volume.c 2024-05-07 09:38:49.215509205 -0400
|
||||
@@ -1471,11 +1471,11 @@
|
||||
|
||||
int __must_check replace_volume_storage(struct volume *volume,
|
||||
struct index_layout *layout,
|
||||
- const char *name)
|
||||
+ struct block_device *bdev)
|
||||
{
|
||||
int result;
|
||||
|
||||
- result = replace_index_layout_storage(layout, name);
|
||||
+ result = replace_index_layout_storage(layout, bdev);
|
||||
if (result != UDS_SUCCESS) {
|
||||
return result;
|
||||
}
|
||||
diff -Naur kvdo-c6254c6db5cfa02ecf5bbb4db2c5728f23aa3b2a.orig/vdo/volume.h kvdo-c6254c6db5cfa02ecf5bbb4db2c5728f23aa3b2a/vdo/volume.h
|
||||
--- kvdo-c6254c6db5cfa02ecf5bbb4db2c5728f23aa3b2a.orig/vdo/volume.h 2023-10-19 18:57:25.000000000 -0400
|
||||
+++ kvdo-c6254c6db5cfa02ecf5bbb4db2c5728f23aa3b2a/vdo/volume.h 2024-05-07 09:38:49.215509205 -0400
|
||||
@@ -95,13 +95,13 @@
|
||||
*
|
||||
* @param volume The volume to reconfigure
|
||||
* @param layout The index layout
|
||||
- * @param path The path to the new backing store
|
||||
+ * @param bdev The backing store block device
|
||||
*
|
||||
* @return UDS_SUCCESS or an error code
|
||||
**/
|
||||
int __must_check replace_volume_storage(struct volume *volume,
|
||||
struct index_layout *layout,
|
||||
- const char *path);
|
||||
+ struct block_device *bdev);
|
||||
|
||||
/**
|
||||
* Enqueue a page read.
|
Loading…
Reference in New Issue
Block a user