Compare commits

..

No commits in common. "9a7e95b5a2a55d963a3c505fda8a076ef90ca3ca" and "cfaa45a042d5d01a6cad5f9b19fa92ea848cac05" have entirely different histories.

6 changed files with 18 additions and 210 deletions

View File

@ -1,25 +0,0 @@
From 7f57cf2b2dcb9dc5b0b08b47e33ce989269dfe78 Mon Sep 17 00:00:00 2001
From: wangshuo <wangshuo@kylinos.cn>
Date: Thu, 12 Dec 2024 20:34:23 +0800
Subject: [PATCH] add loongarch64 support for kmod-kvdo
---
vdo/cpu.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/vdo/cpu.h b/vdo/cpu.h
index ee449b7..b3fbfd9 100644
--- a/vdo/cpu.h
+++ b/vdo/cpu.h
@@ -20,7 +20,7 @@
#define CACHE_LINE_BYTES 128
#elif defined(__s390x__)
#define CACHE_LINE_BYTES 256
-#elif defined(__x86_64__) || defined(__aarch64__) || defined(__riscv)
+#elif defined(__x86_64__) || defined(__aarch64__) || defined(__riscv) || defined(__loongarch64)
#define CACHE_LINE_BYTES 64
#else
#error "unknown cache line size"
--
2.27.0

View File

@ -1,131 +0,0 @@
From 1af6a3f5a848237f5ea045499f33d29b6a8b8fd3 Mon Sep 17 00:00:00 2001
From: wang--ge <wang__ge@126.com>
Date: Tue, 26 Mar 2024 15:06:39 +0800
Subject: [PATCH] init pakcage
---
vdo/io-factory.c | 55 +++++++++++++++++++++++++++++++-----------------
1 file changed, 36 insertions(+), 19 deletions(-)
diff --git a/vdo/io-factory.c b/vdo/io-factory.c
index 1313da2..d0d189b 100644
--- a/vdo/io-factory.c
+++ b/vdo/io-factory.c
@@ -11,7 +11,7 @@
#include "logger.h"
#include "memory-alloc.h"
-enum { BLK_FMODE = FMODE_READ | FMODE_WRITE };
+enum { BLK_FMODE = BLK_OPEN_READ | BLK_OPEN_WRITE };
/*
* A kernel mode IO Factory object controls access to an index stored
@@ -19,6 +19,7 @@ enum { BLK_FMODE = FMODE_READ | FMODE_WRITE };
*/
struct io_factory {
struct block_device *bdev;
+ struct bdev_handle *bdev_h;
atomic_t ref_count;
};
@@ -28,18 +29,30 @@ void get_uds_io_factory(struct io_factory *factory)
}
static int get_block_device_from_name(const char *name,
- struct block_device **bdev)
+ struct bdev_handle **bdev_h)
{
- dev_t device = name_to_dev_t(name);
-
- if (device != 0) {
- *bdev = blkdev_get_by_dev(device, BLK_FMODE, NULL);
+ dev_t device;
+ unsigned int major, minor;
+ char dummy;
+ const struct blk_holder_ops hops = { NULL };
+
+ /* 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_h = NULL;
+ return uds_log_error_strerror(UDS_INVALID_ARGUMENT,
+ "%s is not a valid block device",
+ name);
+ }
+ *bdev_h = bdev_open_by_dev(device, BLK_FMODE, NULL, &hops);
} else {
- *bdev = blkdev_get_by_path(name, BLK_FMODE, NULL);
+ *bdev_h = bdev_open_by_path(name, BLK_FMODE, NULL, &hops);
}
- if (IS_ERR(*bdev)) {
- uds_log_error_strerror(-PTR_ERR(*bdev),
- "%s is not a block device", name);
+
+ if (IS_ERR(*bdev_h)) {
+ uds_log_error_strerror(-PTR_ERR(*bdev_h), "%s is not a block device", name);
+ *bdev_h = NULL;
return UDS_INVALID_ARGUMENT;
}
@@ -49,21 +62,22 @@ static int get_block_device_from_name(const char *name,
int make_uds_io_factory(const char *path, struct io_factory **factory_ptr)
{
int result;
- struct block_device *bdev;
+ struct bdev_handle *bdev_h;
struct io_factory *factory;
- result = get_block_device_from_name(path, &bdev);
+ result = get_block_device_from_name(path, &bdev_h);
if (result != UDS_SUCCESS) {
return result;
}
result = UDS_ALLOCATE(1, struct io_factory, __func__, &factory);
if (result != UDS_SUCCESS) {
- blkdev_put(bdev, BLK_FMODE);
+ bdev_release(bdev_h);
return result;
}
- factory->bdev = bdev;
+ factory->bdev_h = bdev_h;
+ factory->bdev = bdev_h->bdev;
atomic_set_release(&factory->ref_count, 1);
*factory_ptr = factory;
@@ -73,22 +87,25 @@ int make_uds_io_factory(const char *path, struct io_factory **factory_ptr)
int replace_uds_storage(struct io_factory *factory, const char *path)
{
int result;
- struct block_device *bdev;
+ struct bdev_handle *bdev_h;
- result = get_block_device_from_name(path, &bdev);
+ result = get_block_device_from_name(path, &bdev_h);
if (result != UDS_SUCCESS) {
return result;
}
- blkdev_put(factory->bdev, BLK_FMODE);
- factory->bdev = bdev;
+ factory->bdev = NULL;
+ bdev_release(factory->bdev_h);
+ factory->bdev_h = bdev_h;
+ factory->bdev = bdev_h->bdev;
return UDS_SUCCESS;
}
void put_uds_io_factory(struct io_factory *factory)
{
if (atomic_add_return(-1, &factory->ref_count) <= 0) {
- blkdev_put(factory->bdev, BLK_FMODE);
+ factory->bdev=NULL;
+ bdev_release(factory->bdev_h);
UDS_FREE(factory);
}
}
--
2.33.0

View File

@ -1,27 +0,0 @@
diff --git a/vdo/cpu.h b/vdo/cpu.h
index e4b39c2b..ee449b7c 100644
--- a/vdo/cpu.h
+++ b/vdo/cpu.h
@@ -20,7 +20,7 @@
#define CACHE_LINE_BYTES 128
#elif defined(__s390x__)
#define CACHE_LINE_BYTES 256
-#elif defined(__x86_64__) || defined(__aarch64__)
+#elif defined(__x86_64__) || defined(__aarch64__) || defined(__riscv)
#define CACHE_LINE_BYTES 64
#else
#error "unknown cache line size"
diff --git a/vdo/volume.h b/vdo/volume.h
index 3a9a8d5e..93f13a42 100644
--- a/vdo/volume.h
+++ b/vdo/volume.h
@@ -356,6 +356,9 @@ int __must_check get_volume_page(struct volume *volume,
byte **data_ptr,
struct delta_index_page **index_page_ptr);
+#if defined(__riscv)
+#define get_cache_size get_cache_size_alias
+#endif
size_t __must_check get_cache_size(struct volume *volume);
int __must_check

BIN
8.1.0.316.tar.gz Normal file

Binary file not shown.

Binary file not shown.

View File

@ -1,7 +1,7 @@
#This spec is obtained from source code(kvdo-6.2.2.24.tar.gz)
%define spec_release 5
%define spec_release 1
%define kmod_name kmod-kvdo
%define kmod_driver_version 8.2.1.2
%define kmod_driver_version 8.1.0.316
%define kmod_rpm_release %{spec_release}
%define kmod_kernel_version 3.10.0-693.el7
@ -14,17 +14,20 @@ Release: %{kmod_rpm_release}
Summary: Kernel Modules for Virtual Data Optimizer
License: GPLv2+
URL: http://github.com/dm-vdo/kvdo
Source0: https://github.com/dm-vdo/kvdo/archive/refs/tags/%{kmod_driver_version}.tar.gz
Patch1: 01-add-riscv64-support.patch
Patch2: 0002-replace-kernel-obsolete-api.patch
Patch3: 0001-add-loongarch64-support-for-kmod-kvdo.patch
Source0: https://github.com/dm-vdo/kvdo/archive/refs/tags/8.1.0.316.tar.gz
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
Requires: dkms
Requires: kernel-devel >= %{kmod_kernel_version}
Requires: make
ExclusiveArch: x86_64 aarch64 loongarch64 riscv64
ExcludeArch: s390 s390x ppc ppc64 ppc64le i686
ExclusiveArch: x86_64
ExclusiveArch: aarch64
ExcludeArch: s390
ExcludeArch: s390x
ExcludeArch: ppc
ExcludeArch: ppc64
ExcludeArch: ppc64le
ExcludeArch: i686
%description
Virtual Data Optimizer (VDO) is a device mapper target that delivers
@ -64,12 +67,15 @@ PACKAGE_NAME="kvdo"
PACKAGE_VERSION="%{version}-%{kmod_rpm_release}"
AUTOINSTALL="yes"
BUILT_MODULE_NAME[0]="kvdo"
BUILT_MODULE_LOCATION[0]="vdo"
BUILT_MODULE_NAME[0]="uds"
BUILT_MODULE_LOCATION[0]="uds"
DEST_MODULE_LOCATION[0]="/kernel/drivers/block/"
BUILD_DEPENDS[0]=LZ4_COMPRESS
BUILD_DEPENDS[0]=LZ_DECOMPRESS
STRIP[0]="no"
BUILT_MODULE_NAME[1]="kvdo"
BUILT_MODULE_LOCATION[1]="vdo"
DEST_MODULE_LOCATION[1]="/kernel/drivers/block/"
STRIP[1]="no"
EOF
%clean
@ -80,21 +86,6 @@ rm -rf $RPM_BUILD_ROOT
%{_usr}/src/%{kmod_name}-%{version}-%{kmod_rpm_release}/*
%changelog
* Fri Dec 13 2024 wangshuo <wangshuo@kylinos.cn> - 8.2.1.2-5
- vdo/cpu.h: add loongarch64 support, fix dkms build error
* Tue Mar 26 2024 Ge Wang <wang__ge@126.com> - 8.2.1.2-4
- Replace kernel obsolete api
* Wed Apr 12 2023 laokz <zhangkai@iscas.ac.cn> - 8.2.1.2-3
- Add riscv64 support
* Thu Feb 16 2023 Wenlong Zhang<zhangwenlong@loongson.cn> - 8.2.1.2-2
- Add loongarch64 support
* Thu Feb 02 2023 Ge Wang <wangge20@huawei.com> - 8.2.1.2-1
- Upgrade kmod-kvdo to 8.2.1.2
* Wed Dec 29 2021 yaoxin <yaoxin30@huawei.com> - 8.1.0.316-1
- Upgrade kmod-kvdo to 8.1.0.316