Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e651c93a90 | ||
|
|
988e90be69 | ||
|
|
272a45ad63 | ||
|
|
25a15d24cf | ||
|
|
700e0e9bff | ||
|
|
ab0ca7c00f | ||
|
|
f153bc950b | ||
|
|
425ff8818d | ||
|
|
9e287a7778 | ||
|
|
f52f58b9e9 | ||
|
|
1fe6b0c0e2 | ||
|
|
e4237e9ed8 | ||
|
|
10a5fd6abb | ||
|
|
1c316ef350 | ||
|
|
0b2d12eef1 |
+1
-1
@@ -2,6 +2,6 @@ cmake_minimum_required(VERSION 2.8.12)
|
|||||||
|
|
||||||
project(vitastor)
|
project(vitastor)
|
||||||
|
|
||||||
set(VERSION "0.9.4")
|
set(VERSION "0.9.6")
|
||||||
|
|
||||||
add_subdirectory(src)
|
add_subdirectory(src)
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
VERSION ?= v0.9.4
|
VERSION ?= v0.9.6
|
||||||
|
|
||||||
all: build push
|
all: build push
|
||||||
|
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ spec:
|
|||||||
capabilities:
|
capabilities:
|
||||||
add: ["SYS_ADMIN"]
|
add: ["SYS_ADMIN"]
|
||||||
allowPrivilegeEscalation: true
|
allowPrivilegeEscalation: true
|
||||||
image: vitalif/vitastor-csi:v0.9.4
|
image: vitalif/vitastor-csi:v0.9.6
|
||||||
args:
|
args:
|
||||||
- "--node=$(NODE_ID)"
|
- "--node=$(NODE_ID)"
|
||||||
- "--endpoint=$(CSI_ENDPOINT)"
|
- "--endpoint=$(CSI_ENDPOINT)"
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ spec:
|
|||||||
privileged: true
|
privileged: true
|
||||||
capabilities:
|
capabilities:
|
||||||
add: ["SYS_ADMIN"]
|
add: ["SYS_ADMIN"]
|
||||||
image: vitalif/vitastor-csi:v0.9.4
|
image: vitalif/vitastor-csi:v0.9.6
|
||||||
args:
|
args:
|
||||||
- "--node=$(NODE_ID)"
|
- "--node=$(NODE_ID)"
|
||||||
- "--endpoint=$(CSI_ENDPOINT)"
|
- "--endpoint=$(CSI_ENDPOINT)"
|
||||||
|
|||||||
+1
-1
@@ -5,7 +5,7 @@ package vitastor
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
vitastorCSIDriverName = "csi.vitastor.io"
|
vitastorCSIDriverName = "csi.vitastor.io"
|
||||||
vitastorCSIDriverVersion = "0.9.4"
|
vitastorCSIDriverVersion = "0.9.6"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Config struct fills the parameters of request or user input
|
// Config struct fills the parameters of request or user input
|
||||||
|
|||||||
Vendored
+2
-2
@@ -1,10 +1,10 @@
|
|||||||
vitastor (0.9.4-1) unstable; urgency=medium
|
vitastor (0.9.6-1) unstable; urgency=medium
|
||||||
|
|
||||||
* Bugfixes
|
* Bugfixes
|
||||||
|
|
||||||
-- Vitaliy Filippov <vitalif@yourcmc.ru> Fri, 03 Jun 2022 02:09:44 +0300
|
-- Vitaliy Filippov <vitalif@yourcmc.ru> Fri, 03 Jun 2022 02:09:44 +0300
|
||||||
|
|
||||||
vitastor (0.9.4-1) unstable; urgency=medium
|
vitastor (0.9.6-1) unstable; urgency=medium
|
||||||
|
|
||||||
* Implement NFS proxy
|
* Implement NFS proxy
|
||||||
* Add documentation
|
* Add documentation
|
||||||
|
|||||||
Vendored
+4
-4
@@ -35,8 +35,8 @@ RUN set -e -x; \
|
|||||||
mkdir -p /root/packages/vitastor-$REL; \
|
mkdir -p /root/packages/vitastor-$REL; \
|
||||||
rm -rf /root/packages/vitastor-$REL/*; \
|
rm -rf /root/packages/vitastor-$REL/*; \
|
||||||
cd /root/packages/vitastor-$REL; \
|
cd /root/packages/vitastor-$REL; \
|
||||||
cp -r /root/vitastor vitastor-0.9.4; \
|
cp -r /root/vitastor vitastor-0.9.6; \
|
||||||
cd vitastor-0.9.4; \
|
cd vitastor-0.9.6; \
|
||||||
ln -s /root/fio-build/fio-*/ ./fio; \
|
ln -s /root/fio-build/fio-*/ ./fio; \
|
||||||
FIO=$(head -n1 fio/debian/changelog | perl -pe 's/^.*\((.*?)\).*$/$1/'); \
|
FIO=$(head -n1 fio/debian/changelog | perl -pe 's/^.*\((.*?)\).*$/$1/'); \
|
||||||
ls /usr/include/linux/raw.h || cp ./debian/raw.h /usr/include/linux/raw.h; \
|
ls /usr/include/linux/raw.h || cp ./debian/raw.h /usr/include/linux/raw.h; \
|
||||||
@@ -49,8 +49,8 @@ RUN set -e -x; \
|
|||||||
rm -rf a b; \
|
rm -rf a b; \
|
||||||
echo "dep:fio=$FIO" > debian/fio_version; \
|
echo "dep:fio=$FIO" > debian/fio_version; \
|
||||||
cd /root/packages/vitastor-$REL; \
|
cd /root/packages/vitastor-$REL; \
|
||||||
tar --sort=name --mtime='2020-01-01' --owner=0 --group=0 --exclude=debian -cJf vitastor_0.9.4.orig.tar.xz vitastor-0.9.4; \
|
tar --sort=name --mtime='2020-01-01' --owner=0 --group=0 --exclude=debian -cJf vitastor_0.9.6.orig.tar.xz vitastor-0.9.6; \
|
||||||
cd vitastor-0.9.4; \
|
cd vitastor-0.9.6; \
|
||||||
V=$(head -n1 debian/changelog | perl -pe 's/^.*\((.*?)\).*$/$1/'); \
|
V=$(head -n1 debian/changelog | perl -pe 's/^.*\((.*?)\).*$/$1/'); \
|
||||||
DEBFULLNAME="Vitaliy Filippov <vitalif@yourcmc.ru>" dch -D $REL -v "$V""$REL" "Rebuild for $REL"; \
|
DEBFULLNAME="Vitaliy Filippov <vitalif@yourcmc.ru>" dch -D $REL -v "$V""$REL" "Rebuild for $REL"; \
|
||||||
DEB_BUILD_OPTIONS=nocheck dpkg-buildpackage --jobs=auto -sa; \
|
DEB_BUILD_OPTIONS=nocheck dpkg-buildpackage --jobs=auto -sa; \
|
||||||
|
|||||||
@@ -107,7 +107,8 @@ disabled by now, so if you want to try it on Debian, use a kernel from Ubuntu
|
|||||||
Commands to attach Vitastor image as a VDUSE device:
|
Commands to attach Vitastor image as a VDUSE device:
|
||||||
|
|
||||||
```
|
```
|
||||||
modprobe vduse virtio-vdpa
|
modprobe vduse
|
||||||
|
modprobe virtio-vdpa
|
||||||
qemu-storage-daemon --daemonize --blockdev '{"node-name":"test1","driver":"vitastor",\
|
qemu-storage-daemon --daemonize --blockdev '{"node-name":"test1","driver":"vitastor",\
|
||||||
"etcd-host":"192.168.7.2:2379/v3","image":"testosd1","cache":{"direct":true,"no-flush":false},"discard":"unmap"}' \
|
"etcd-host":"192.168.7.2:2379/v3","image":"testosd1","cache":{"direct":true,"no-flush":false},"discard":"unmap"}' \
|
||||||
--export vduse-blk,id=test1,node-name=test1,name=test1,num-queues=16,queue-size=128,writable=true
|
--export vduse-blk,id=test1,node-name=test1,name=test1,num-queues=16,queue-size=128,writable=true
|
||||||
|
|||||||
@@ -111,7 +111,8 @@ VDUSE (CONFIG_VIRTIO_VDPA=m и CONFIG_VDPA_USER=m). В ядрах в Debian Linu
|
|||||||
Команды для подключения виртуального диска через VDUSE:
|
Команды для подключения виртуального диска через VDUSE:
|
||||||
|
|
||||||
```
|
```
|
||||||
modprobe vduse virtio-vdpa
|
modprobe vduse
|
||||||
|
modprobe virtio-vdpa
|
||||||
qemu-storage-daemon --daemonize --blockdev '{"node-name":"test1","driver":"vitastor",\
|
qemu-storage-daemon --daemonize --blockdev '{"node-name":"test1","driver":"vitastor",\
|
||||||
"etcd-host":"192.168.7.2:2379/v3","image":"testosd1","cache":{"direct":true,"no-flush":false},"discard":"unmap"}' \
|
"etcd-host":"192.168.7.2:2379/v3","image":"testosd1","cache":{"direct":true,"no-flush":false},"discard":"unmap"}' \
|
||||||
--export vduse-blk,id=test1,node-name=test1,name=test1,num-queues=16,queue-size=128,writable=true
|
--export vduse-blk,id=test1,node-name=test1,name=test1,num-queues=16,queue-size=128,writable=true
|
||||||
|
|||||||
+6
-2
@@ -1497,10 +1497,14 @@ class Mon
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
const pool_cfg = (this.state.config.pools[pool_id]||{});
|
||||||
if (!object_size)
|
if (!object_size)
|
||||||
{
|
{
|
||||||
object_size = (this.state.config.pools[pool_id]||{}).block_size ||
|
object_size = pool_cfg.block_size || this.config.block_size || 131072;
|
||||||
this.config.block_size || 131072;
|
}
|
||||||
|
if (pool_cfg.scheme !== 'replicated')
|
||||||
|
{
|
||||||
|
object_size *= ((pool_cfg.pg_size||0) - (pool_cfg.parity_chunks||0));
|
||||||
}
|
}
|
||||||
object_size = BigInt(object_size);
|
object_size = BigInt(object_size);
|
||||||
for (const pg_num in this.state.pg.stats[pool_id])
|
for (const pg_num in this.state.pg.stats[pool_id])
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ from cinder.volume import configuration
|
|||||||
from cinder.volume import driver
|
from cinder.volume import driver
|
||||||
from cinder.volume import volume_utils
|
from cinder.volume import volume_utils
|
||||||
|
|
||||||
VERSION = '0.9.4'
|
VERSION = '0.9.6'
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|||||||
@@ -24,4 +24,4 @@ rm fio
|
|||||||
mv fio-copy fio
|
mv fio-copy fio
|
||||||
FIO=`rpm -qi fio | perl -e 'while(<>) { /^Epoch[\s:]+(\S+)/ && print "$1:"; /^Version[\s:]+(\S+)/ && print $1; /^Release[\s:]+(\S+)/ && print "-$1"; }'`
|
FIO=`rpm -qi fio | perl -e 'while(<>) { /^Epoch[\s:]+(\S+)/ && print "$1:"; /^Version[\s:]+(\S+)/ && print $1; /^Release[\s:]+(\S+)/ && print "-$1"; }'`
|
||||||
perl -i -pe 's/(Requires:\s*fio)([^\n]+)?/$1 = '$FIO'/' $VITASTOR/rpm/vitastor-el$EL.spec
|
perl -i -pe 's/(Requires:\s*fio)([^\n]+)?/$1 = '$FIO'/' $VITASTOR/rpm/vitastor-el$EL.spec
|
||||||
tar --transform 's#^#vitastor-0.9.4/#' --exclude 'rpm/*.rpm' -czf $VITASTOR/../vitastor-0.9.4$(rpm --eval '%dist').tar.gz *
|
tar --transform 's#^#vitastor-0.9.6/#' --exclude 'rpm/*.rpm' -czf $VITASTOR/../vitastor-0.9.6$(rpm --eval '%dist').tar.gz *
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ ADD . /root/vitastor
|
|||||||
RUN set -e; \
|
RUN set -e; \
|
||||||
cd /root/vitastor/rpm; \
|
cd /root/vitastor/rpm; \
|
||||||
sh build-tarball.sh; \
|
sh build-tarball.sh; \
|
||||||
cp /root/vitastor-0.9.4.el7.tar.gz ~/rpmbuild/SOURCES; \
|
cp /root/vitastor-0.9.6.el7.tar.gz ~/rpmbuild/SOURCES; \
|
||||||
cp vitastor-el7.spec ~/rpmbuild/SPECS/vitastor.spec; \
|
cp vitastor-el7.spec ~/rpmbuild/SPECS/vitastor.spec; \
|
||||||
cd ~/rpmbuild/SPECS/; \
|
cd ~/rpmbuild/SPECS/; \
|
||||||
rpmbuild -ba vitastor.spec; \
|
rpmbuild -ba vitastor.spec; \
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
Name: vitastor
|
Name: vitastor
|
||||||
Version: 0.9.4
|
Version: 0.9.6
|
||||||
Release: 1%{?dist}
|
Release: 1%{?dist}
|
||||||
Summary: Vitastor, a fast software-defined clustered block storage
|
Summary: Vitastor, a fast software-defined clustered block storage
|
||||||
|
|
||||||
License: Vitastor Network Public License 1.1
|
License: Vitastor Network Public License 1.1
|
||||||
URL: https://vitastor.io/
|
URL: https://vitastor.io/
|
||||||
Source0: vitastor-0.9.4.el7.tar.gz
|
Source0: vitastor-0.9.6.el7.tar.gz
|
||||||
|
|
||||||
BuildRequires: liburing-devel >= 0.6
|
BuildRequires: liburing-devel >= 0.6
|
||||||
BuildRequires: gperftools-devel
|
BuildRequires: gperftools-devel
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ ADD . /root/vitastor
|
|||||||
RUN set -e; \
|
RUN set -e; \
|
||||||
cd /root/vitastor/rpm; \
|
cd /root/vitastor/rpm; \
|
||||||
sh build-tarball.sh; \
|
sh build-tarball.sh; \
|
||||||
cp /root/vitastor-0.9.4.el8.tar.gz ~/rpmbuild/SOURCES; \
|
cp /root/vitastor-0.9.6.el8.tar.gz ~/rpmbuild/SOURCES; \
|
||||||
cp vitastor-el8.spec ~/rpmbuild/SPECS/vitastor.spec; \
|
cp vitastor-el8.spec ~/rpmbuild/SPECS/vitastor.spec; \
|
||||||
cd ~/rpmbuild/SPECS/; \
|
cd ~/rpmbuild/SPECS/; \
|
||||||
rpmbuild -ba vitastor.spec; \
|
rpmbuild -ba vitastor.spec; \
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
Name: vitastor
|
Name: vitastor
|
||||||
Version: 0.9.4
|
Version: 0.9.6
|
||||||
Release: 1%{?dist}
|
Release: 1%{?dist}
|
||||||
Summary: Vitastor, a fast software-defined clustered block storage
|
Summary: Vitastor, a fast software-defined clustered block storage
|
||||||
|
|
||||||
License: Vitastor Network Public License 1.1
|
License: Vitastor Network Public License 1.1
|
||||||
URL: https://vitastor.io/
|
URL: https://vitastor.io/
|
||||||
Source0: vitastor-0.9.4.el8.tar.gz
|
Source0: vitastor-0.9.6.el8.tar.gz
|
||||||
|
|
||||||
BuildRequires: liburing-devel >= 0.6
|
BuildRequires: liburing-devel >= 0.6
|
||||||
BuildRequires: gperftools-devel
|
BuildRequires: gperftools-devel
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ ADD . /root/vitastor
|
|||||||
RUN set -e; \
|
RUN set -e; \
|
||||||
cd /root/vitastor/rpm; \
|
cd /root/vitastor/rpm; \
|
||||||
sh build-tarball.sh; \
|
sh build-tarball.sh; \
|
||||||
cp /root/vitastor-0.9.4.el9.tar.gz ~/rpmbuild/SOURCES; \
|
cp /root/vitastor-0.9.6.el9.tar.gz ~/rpmbuild/SOURCES; \
|
||||||
cp vitastor-el9.spec ~/rpmbuild/SPECS/vitastor.spec; \
|
cp vitastor-el9.spec ~/rpmbuild/SPECS/vitastor.spec; \
|
||||||
cd ~/rpmbuild/SPECS/; \
|
cd ~/rpmbuild/SPECS/; \
|
||||||
rpmbuild -ba vitastor.spec; \
|
rpmbuild -ba vitastor.spec; \
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
Name: vitastor
|
Name: vitastor
|
||||||
Version: 0.9.4
|
Version: 0.9.6
|
||||||
Release: 1%{?dist}
|
Release: 1%{?dist}
|
||||||
Summary: Vitastor, a fast software-defined clustered block storage
|
Summary: Vitastor, a fast software-defined clustered block storage
|
||||||
|
|
||||||
License: Vitastor Network Public License 1.1
|
License: Vitastor Network Public License 1.1
|
||||||
URL: https://vitastor.io/
|
URL: https://vitastor.io/
|
||||||
Source0: vitastor-0.9.4.el9.tar.gz
|
Source0: vitastor-0.9.6.el9.tar.gz
|
||||||
|
|
||||||
BuildRequires: liburing-devel >= 0.6
|
BuildRequires: liburing-devel >= 0.6
|
||||||
BuildRequires: gperftools-devel
|
BuildRequires: gperftools-devel
|
||||||
|
|||||||
+1
-1
@@ -16,7 +16,7 @@ if("${CMAKE_INSTALL_PREFIX}" MATCHES "^/usr/local/?$")
|
|||||||
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
|
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_definitions(-DVERSION="0.9.4")
|
add_definitions(-DVERSION="0.9.6")
|
||||||
add_definitions(-Wall -Wno-sign-compare -Wno-comment -Wno-parentheses -Wno-pointer-arith -fdiagnostics-color=always -I ${CMAKE_SOURCE_DIR}/src)
|
add_definitions(-Wall -Wno-sign-compare -Wno-comment -Wno-parentheses -Wno-pointer-arith -fdiagnostics-color=always -I ${CMAKE_SOURCE_DIR}/src)
|
||||||
if (${WITH_ASAN})
|
if (${WITH_ASAN})
|
||||||
add_definitions(-fsanitize=address -fno-omit-frame-pointer)
|
add_definitions(-fsanitize=address -fno-omit-frame-pointer)
|
||||||
|
|||||||
@@ -85,11 +85,13 @@ void blockstore_impl_t::parse_config(blockstore_config_t & config, bool init)
|
|||||||
immediate_commit = IMMEDIATE_SMALL;
|
immediate_commit = IMMEDIATE_SMALL;
|
||||||
}
|
}
|
||||||
metadata_buf_size = strtoull(config["meta_buf_size"].c_str(), NULL, 10);
|
metadata_buf_size = strtoull(config["meta_buf_size"].c_str(), NULL, 10);
|
||||||
inmemory_meta = config["inmemory_metadata"] != "false";
|
inmemory_meta = config["inmemory_metadata"] != "false" && config["inmemory_metadata"] != "0" &&
|
||||||
|
config["inmemory_metadata"] != "no";
|
||||||
journal.sector_count = strtoull(config["journal_sector_buffer_count"].c_str(), NULL, 10);
|
journal.sector_count = strtoull(config["journal_sector_buffer_count"].c_str(), NULL, 10);
|
||||||
journal.no_same_sector_overwrites = config["journal_no_same_sector_overwrites"] == "true" ||
|
journal.no_same_sector_overwrites = config["journal_no_same_sector_overwrites"] == "true" ||
|
||||||
config["journal_no_same_sector_overwrites"] == "1" || config["journal_no_same_sector_overwrites"] == "yes";
|
config["journal_no_same_sector_overwrites"] == "1" || config["journal_no_same_sector_overwrites"] == "yes";
|
||||||
journal.inmemory = config["inmemory_journal"] != "false";
|
journal.inmemory = config["inmemory_journal"] != "false" && config["inmemory_journal"] != "0" &&
|
||||||
|
config["inmemory_journal"] != "no";
|
||||||
// Validate
|
// Validate
|
||||||
if (journal.sector_count < 2)
|
if (journal.sector_count < 2)
|
||||||
{
|
{
|
||||||
|
|||||||
+6
-4
@@ -379,16 +379,18 @@ resume_1:
|
|||||||
|
|
||||||
std::string print_table(json11::Json items, json11::Json header, bool use_esc)
|
std::string print_table(json11::Json items, json11::Json header, bool use_esc)
|
||||||
{
|
{
|
||||||
|
int header_sizes[header.array_items().size()];
|
||||||
std::vector<int> sizes;
|
std::vector<int> sizes;
|
||||||
for (int i = 0; i < header.array_items().size(); i++)
|
for (int i = 0; i < header.array_items().size(); i++)
|
||||||
{
|
{
|
||||||
sizes.push_back(header[i]["title"].string_value().length());
|
header_sizes[i] = utf8_length(header[i]["title"].string_value());
|
||||||
|
sizes.push_back(header_sizes[i]);
|
||||||
}
|
}
|
||||||
for (auto & item: items.array_items())
|
for (auto & item: items.array_items())
|
||||||
{
|
{
|
||||||
for (int i = 0; i < header.array_items().size(); i++)
|
for (int i = 0; i < header.array_items().size(); i++)
|
||||||
{
|
{
|
||||||
int l = item[header[i]["key"].string_value()].as_string().length();
|
int l = utf8_length(item[header[i]["key"].string_value()].as_string());
|
||||||
sizes[i] = sizes[i] < l ? l : sizes[i];
|
sizes[i] = sizes[i] < l ? l : sizes[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -400,7 +402,7 @@ std::string print_table(json11::Json items, json11::Json header, bool use_esc)
|
|||||||
// Separator
|
// Separator
|
||||||
str += " ";
|
str += " ";
|
||||||
}
|
}
|
||||||
int pad = sizes[i]-header[i]["title"].string_value().length();
|
int pad = sizes[i]-header_sizes[i];
|
||||||
if (header[i]["right"].bool_value())
|
if (header[i]["right"].bool_value())
|
||||||
{
|
{
|
||||||
// Align right
|
// Align right
|
||||||
@@ -428,7 +430,7 @@ std::string print_table(json11::Json items, json11::Json header, bool use_esc)
|
|||||||
// Separator
|
// Separator
|
||||||
str += " ";
|
str += " ";
|
||||||
}
|
}
|
||||||
int pad = sizes[i] - item[header[i]["key"].string_value()].as_string().length();
|
int pad = sizes[i] - utf8_length(item[header[i]["key"].string_value()].as_string());
|
||||||
if (header[i]["right"].bool_value())
|
if (header[i]["right"].bool_value())
|
||||||
{
|
{
|
||||||
// Align right
|
// Align right
|
||||||
|
|||||||
+4
-3
@@ -13,7 +13,7 @@ struct image_changer_t
|
|||||||
std::string image_name;
|
std::string image_name;
|
||||||
std::string new_name;
|
std::string new_name;
|
||||||
uint64_t new_size = 0;
|
uint64_t new_size = 0;
|
||||||
bool force_size = false;
|
bool force_size = false, inc_size = false;
|
||||||
bool set_readonly = false, set_readwrite = false, force = false;
|
bool set_readonly = false, set_readwrite = false, force = false;
|
||||||
// interval between fsyncs
|
// interval between fsyncs
|
||||||
int fsync_interval = 128;
|
int fsync_interval = 128;
|
||||||
@@ -81,14 +81,14 @@ struct image_changer_t
|
|||||||
}
|
}
|
||||||
if ((!set_readwrite || !cfg.readonly) &&
|
if ((!set_readwrite || !cfg.readonly) &&
|
||||||
(!set_readonly || cfg.readonly) &&
|
(!set_readonly || cfg.readonly) &&
|
||||||
(!new_size && !force_size || cfg.size == new_size) &&
|
(!new_size && !force_size || cfg.size == new_size || cfg.size >= new_size && inc_size) &&
|
||||||
(new_name == "" || new_name == image_name))
|
(new_name == "" || new_name == image_name))
|
||||||
{
|
{
|
||||||
result = (cli_result_t){ .text = "No change" };
|
result = (cli_result_t){ .text = "No change" };
|
||||||
state = 100;
|
state = 100;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (new_size != 0 || force_size)
|
if ((new_size != 0 || force_size) && (cfg.size < new_size || !inc_size))
|
||||||
{
|
{
|
||||||
if (cfg.size >= new_size)
|
if (cfg.size >= new_size)
|
||||||
{
|
{
|
||||||
@@ -233,6 +233,7 @@ std::function<bool(cli_result_t &)> cli_tool_t::start_modify(json11::Json cfg)
|
|||||||
changer->new_name = cfg["rename"].string_value();
|
changer->new_name = cfg["rename"].string_value();
|
||||||
changer->new_size = parse_size(cfg["resize"].as_string());
|
changer->new_size = parse_size(cfg["resize"].as_string());
|
||||||
changer->force_size = cfg["force_size"].bool_value();
|
changer->force_size = cfg["force_size"].bool_value();
|
||||||
|
changer->inc_size = cfg["inc_size"].bool_value();
|
||||||
changer->force = cfg["force"].bool_value();
|
changer->force = cfg["force"].bool_value();
|
||||||
changer->set_readonly = cfg["readonly"].bool_value();
|
changer->set_readonly = cfg["readonly"].bool_value();
|
||||||
changer->set_readwrite = cfg["readwrite"].bool_value();
|
changer->set_readwrite = cfg["readwrite"].bool_value();
|
||||||
|
|||||||
@@ -147,7 +147,7 @@ int disk_tool_t::prepare_one(std::map<std::string, std::string> options, int is_
|
|||||||
for (int i = 0; i < sizeof(allow_additional_params)/sizeof(allow_additional_params[0]); i++)
|
for (int i = 0; i < sizeof(allow_additional_params)/sizeof(allow_additional_params[0]); i++)
|
||||||
{
|
{
|
||||||
auto it = options.find(allow_additional_params[i]);
|
auto it = options.find(allow_additional_params[i]);
|
||||||
if (it != options.end())
|
if (it != options.end() && it->second != "")
|
||||||
{
|
{
|
||||||
sb[it->first] = it->second;
|
sb[it->first] = it->second;
|
||||||
}
|
}
|
||||||
@@ -621,7 +621,7 @@ int disk_tool_t::prepare(std::vector<std::string> devices)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Treat all disks as SSDs if not in the hybrid mode
|
// Treat all disks as SSDs if not in the hybrid mode
|
||||||
prepare_one(options, hybrid && dev.is_hdd ? 1 : 0);
|
prepare_one(options, dev.is_hdd ? 1 : 0);
|
||||||
if (hybrid)
|
if (hybrid)
|
||||||
{
|
{
|
||||||
options.erase("journal_device");
|
options.erase("journal_device");
|
||||||
|
|||||||
@@ -264,6 +264,7 @@ int write_zero(int fd, uint64_t offset, uint64_t size)
|
|||||||
{
|
{
|
||||||
uint64_t buf_len = 1024*1024;
|
uint64_t buf_len = 1024*1024;
|
||||||
void *zero_buf = memalign_or_die(MEM_ALIGNMENT, buf_len);
|
void *zero_buf = memalign_or_die(MEM_ALIGNMENT, buf_len);
|
||||||
|
memset(zero_buf, 0, buf_len);
|
||||||
ssize_t r;
|
ssize_t r;
|
||||||
while (size > 0)
|
while (size > 0)
|
||||||
{
|
{
|
||||||
|
|||||||
+158
-58
@@ -190,7 +190,15 @@ static int nfs3_setattr_proc(void *opaque, rpc_op_t *rop)
|
|||||||
{
|
{
|
||||||
if (handle == "roothandle" || self->parent->dir_by_hash.find(handle) != self->parent->dir_by_hash.end())
|
if (handle == "roothandle" || self->parent->dir_by_hash.find(handle) != self->parent->dir_by_hash.end())
|
||||||
{
|
{
|
||||||
*reply = (SETATTR3res){ .status = NFS3ERR_ISDIR };
|
if (args->new_attributes.size.set_it)
|
||||||
|
{
|
||||||
|
*reply = (SETATTR3res){ .status = NFS3ERR_ISDIR };
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Silently ignore mode, uid, gid, atime, mtime changes
|
||||||
|
*reply = (SETATTR3res){ .status = NFS3_OK };
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -358,7 +366,6 @@ static int nfs3_read_proc(void *opaque, rpc_op_t *rop)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void nfs_resize_write(nfs_client_t *self, rpc_op_t *rop, uint64_t inode, uint64_t new_size, uint64_t offset, uint64_t count, void *buf);
|
static void nfs_resize_write(nfs_client_t *self, rpc_op_t *rop, uint64_t inode, uint64_t new_size, uint64_t offset, uint64_t count, void *buf);
|
||||||
static void nfs_do_write(nfs_client_t *self, rpc_op_t *rop, uint64_t inode, uint64_t offset, uint64_t count, void *buf);
|
|
||||||
|
|
||||||
static int nfs3_write_proc(void *opaque, rpc_op_t *rop)
|
static int nfs3_write_proc(void *opaque, rpc_op_t *rop)
|
||||||
{
|
{
|
||||||
@@ -392,7 +399,6 @@ static int nfs3_write_proc(void *opaque, rpc_op_t *rop)
|
|||||||
.resok = (WRITE3resok){
|
.resok = (WRITE3resok){
|
||||||
//.file_wcc = ...,
|
//.file_wcc = ...,
|
||||||
.count = (unsigned)count,
|
.count = (unsigned)count,
|
||||||
.committed = args->stable,
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
if ((args->offset % alignment) != 0 || (count % alignment) != 0)
|
if ((args->offset % alignment) != 0 || (count % alignment) != 0)
|
||||||
@@ -436,42 +442,101 @@ static int nfs3_write_proc(void *opaque, rpc_op_t *rop)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void nfs_resize_write(nfs_client_t *self, rpc_op_t *rop, uint64_t inode, uint64_t new_size, uint64_t offset, uint64_t count, void *buf)
|
static void complete_extend_write(nfs_client_t *self, rpc_op_t *rop, inode_t inode, int res)
|
||||||
{
|
{
|
||||||
// Check if we have to resize the inode before writing
|
WRITE3args *args = (WRITE3args*)rop->request;
|
||||||
|
WRITE3res *reply = (WRITE3res*)rop->reply;
|
||||||
|
if (res < 0)
|
||||||
|
{
|
||||||
|
*reply = (WRITE3res){ .status = vitastor_nfs_map_err(res) };
|
||||||
|
rpc_queue_reply(rop);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
bool imm = self->parent->cli->get_immediate_commit(inode);
|
||||||
|
reply->resok.committed = args->stable != UNSTABLE || imm ? FILE_SYNC : UNSTABLE;
|
||||||
|
*(uint64_t*)reply->resok.verf = self->parent->server_id;
|
||||||
|
if (args->stable != UNSTABLE && !imm)
|
||||||
|
{
|
||||||
|
// Client requested a stable write. Add an fsync
|
||||||
|
auto op = new cluster_op_t;
|
||||||
|
op->opcode = OSD_OP_SYNC;
|
||||||
|
op->callback = [rop](cluster_op_t *op)
|
||||||
|
{
|
||||||
|
if (op->retval != 0)
|
||||||
|
{
|
||||||
|
WRITE3res *reply = (WRITE3res*)rop->reply;
|
||||||
|
*reply = (WRITE3res){ .status = vitastor_nfs_map_err(-op->retval) };
|
||||||
|
}
|
||||||
|
delete op;
|
||||||
|
rpc_queue_reply(rop);
|
||||||
|
};
|
||||||
|
self->parent->cli->execute(op);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rpc_queue_reply(rop);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void complete_extend_inode(nfs_client_t *self, uint64_t inode, uint64_t new_size, int err)
|
||||||
|
{
|
||||||
|
auto ext_it = self->extend_writes.lower_bound((extend_size_t){ .inode = inode, .new_size = 0 });
|
||||||
|
while (ext_it != self->extend_writes.end() &&
|
||||||
|
ext_it->first.inode == inode &&
|
||||||
|
ext_it->first.new_size <= new_size)
|
||||||
|
{
|
||||||
|
ext_it->second.resize_res = err;
|
||||||
|
if (ext_it->second.write_res <= 0)
|
||||||
|
{
|
||||||
|
complete_extend_write(self, ext_it->second.rop, inode, ext_it->second.write_res < 0
|
||||||
|
? ext_it->second.write_res : ext_it->second.resize_res);
|
||||||
|
self->extend_writes.erase(ext_it++);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
ext_it++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void extend_inode(nfs_client_t *self, uint64_t inode, uint64_t new_size)
|
||||||
|
{
|
||||||
|
// Send an extend request
|
||||||
|
auto & ext = self->extends[inode];
|
||||||
|
ext.cur_extend = new_size;
|
||||||
auto inode_it = self->parent->cli->st_cli.inode_config.find(inode);
|
auto inode_it = self->parent->cli->st_cli.inode_config.find(inode);
|
||||||
if (inode_it != self->parent->cli->st_cli.inode_config.end() &&
|
if (inode_it != self->parent->cli->st_cli.inode_config.end() &&
|
||||||
inode_it->second.size < new_size)
|
inode_it->second.size < new_size)
|
||||||
{
|
{
|
||||||
self->parent->cmd->loop_and_wait(self->parent->cmd->start_modify(json11::Json::object {
|
self->parent->cmd->loop_and_wait(self->parent->cmd->start_modify(json11::Json::object {
|
||||||
|
// FIXME: Resizing by ID is probably more correct
|
||||||
{ "image", inode_it->second.name },
|
{ "image", inode_it->second.name },
|
||||||
{ "resize", new_size },
|
{ "resize", new_size },
|
||||||
|
{ "inc_size", true },
|
||||||
{ "force_size", true },
|
{ "force_size", true },
|
||||||
}), [=](const cli_result_t & r)
|
}), [=](const cli_result_t & r)
|
||||||
{
|
{
|
||||||
|
auto & ext = self->extends[inode];
|
||||||
if (r.err)
|
if (r.err)
|
||||||
{
|
{
|
||||||
if (r.err == EAGAIN)
|
fprintf(stderr, "Error extending inode %lu to %lu bytes: %s\n", inode, new_size, r.text.c_str());
|
||||||
{
|
}
|
||||||
// Multiple concurrent resize requests received, try to repeat
|
if (r.err == EAGAIN || ext.next_extend > ext.cur_extend)
|
||||||
nfs_resize_write(self, rop, inode, new_size, offset, count, buf);
|
{
|
||||||
return;
|
// Multiple concurrent resize requests received, try to repeat
|
||||||
}
|
extend_inode(self, inode, ext.next_extend > ext.cur_extend ? ext.next_extend : ext.cur_extend);
|
||||||
WRITE3res *reply = (WRITE3res*)rop->reply;
|
|
||||||
*reply = (WRITE3res){ .status = vitastor_nfs_map_err(r.err) };
|
|
||||||
rpc_queue_reply(rop);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
nfs_do_write(self, rop, inode, offset, count, buf);
|
ext.cur_extend = ext.next_extend = 0;
|
||||||
|
complete_extend_inode(self, inode, new_size, r.err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
nfs_do_write(self, rop, inode, offset, count, buf);
|
complete_extend_inode(self, inode, new_size, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void nfs_do_write(nfs_client_t *self, rpc_op_t *rop, uint64_t inode, uint64_t offset, uint64_t count, void *buf)
|
static void nfs_do_write(nfs_client_t *self, std::multimap<extend_size_t, extend_write_t>::iterator ewr_it,
|
||||||
|
rpc_op_t *rop, uint64_t inode, uint64_t offset, uint64_t count, void *buf)
|
||||||
{
|
{
|
||||||
cluster_op_t *op = new cluster_op_t;
|
cluster_op_t *op = new cluster_op_t;
|
||||||
op->opcode = OSD_OP_WRITE;
|
op->opcode = OSD_OP_WRITE;
|
||||||
@@ -479,48 +544,61 @@ static void nfs_do_write(nfs_client_t *self, rpc_op_t *rop, uint64_t inode, uint
|
|||||||
op->offset = offset;
|
op->offset = offset;
|
||||||
op->len = count;
|
op->len = count;
|
||||||
op->iov.push_back(buf, count);
|
op->iov.push_back(buf, count);
|
||||||
op->callback = [self, rop](cluster_op_t *op)
|
op->callback = [self, ewr_it, rop](cluster_op_t *op)
|
||||||
{
|
{
|
||||||
uint64_t inode = op->inode;
|
auto inode = op->inode;
|
||||||
WRITE3args *args = (WRITE3args*)rop->request;
|
int write_res = op->retval < 0 ? op->retval : (op->retval != op->len ? -ERANGE : 0);
|
||||||
WRITE3res *reply = (WRITE3res*)rop->reply;
|
if (ewr_it == self->extend_writes.end())
|
||||||
if (op->retval != op->len)
|
|
||||||
{
|
{
|
||||||
*reply = (WRITE3res){ .status = vitastor_nfs_map_err(-op->retval) };
|
complete_extend_write(self, rop, inode, write_res);
|
||||||
delete op;
|
|
||||||
rpc_queue_reply(rop);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
*(uint64_t*)reply->resok.verf = self->parent->server_id;
|
ewr_it->second.write_res = write_res;
|
||||||
delete op;
|
if (ewr_it->second.resize_res <= 0)
|
||||||
if (args->stable != UNSTABLE &&
|
|
||||||
!self->parent->cli->get_immediate_commit(inode))
|
|
||||||
{
|
{
|
||||||
// Client requested a stable write. Add an fsync
|
complete_extend_write(self, rop, inode, write_res < 0 ? write_res : ewr_it->second.resize_res);
|
||||||
op = new cluster_op_t;
|
self->extend_writes.erase(ewr_it);
|
||||||
op->opcode = OSD_OP_SYNC;
|
|
||||||
op->callback = [rop](cluster_op_t *op)
|
|
||||||
{
|
|
||||||
if (op->retval != 0)
|
|
||||||
{
|
|
||||||
WRITE3res *reply = (WRITE3res*)rop->reply;
|
|
||||||
*reply = (WRITE3res){ .status = vitastor_nfs_map_err(-op->retval) };
|
|
||||||
}
|
|
||||||
delete op;
|
|
||||||
rpc_queue_reply(rop);
|
|
||||||
};
|
|
||||||
self->parent->cli->execute(op);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
rpc_queue_reply(rop);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
self->parent->cli->execute(op);
|
self->parent->cli->execute(op);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void nfs_resize_write(nfs_client_t *self, rpc_op_t *rop, uint64_t inode, uint64_t new_size, uint64_t offset, uint64_t count, void *buf)
|
||||||
|
{
|
||||||
|
// Check if we have to resize the inode during write
|
||||||
|
auto inode_it = self->parent->cli->st_cli.inode_config.find(inode);
|
||||||
|
if (inode_it != self->parent->cli->st_cli.inode_config.end() &&
|
||||||
|
inode_it->second.size < new_size)
|
||||||
|
{
|
||||||
|
auto ewr_it = self->extend_writes.emplace((extend_size_t){
|
||||||
|
.inode = inode,
|
||||||
|
.new_size = new_size,
|
||||||
|
}, (extend_write_t){
|
||||||
|
.rop = rop,
|
||||||
|
.resize_res = 1,
|
||||||
|
.write_res = 1,
|
||||||
|
});
|
||||||
|
auto & ext = self->extends[inode];
|
||||||
|
if (ext.cur_extend > 0)
|
||||||
|
{
|
||||||
|
// Already resizing, just wait
|
||||||
|
if (ext.next_extend < new_size)
|
||||||
|
ext.next_extend = new_size;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
extend_inode(self, inode, new_size);
|
||||||
|
}
|
||||||
|
nfs_do_write(self, ewr_it, rop, inode, offset, count, buf);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nfs_do_write(self, self->extend_writes.end(), rop, inode, offset, count, buf);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static int nfs3_create_proc(void *opaque, rpc_op_t *rop)
|
static int nfs3_create_proc(void *opaque, rpc_op_t *rop)
|
||||||
{
|
{
|
||||||
nfs_client_t *self = (nfs_client_t*)opaque;
|
nfs_client_t *self = (nfs_client_t*)opaque;
|
||||||
@@ -881,6 +959,27 @@ static int nfs3_link_proc(void *opaque, rpc_op_t *rop)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void fill_dir_entry(nfs_client_t *self, rpc_op_t *rop,
|
||||||
|
std::map<std::string, nfs_dir_t>::iterator dir_id_it, struct entryplus3 *entry, bool is_plus)
|
||||||
|
{
|
||||||
|
if (dir_id_it == self->parent->dir_info.end())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
entry->fileid = dir_id_it->second.id;
|
||||||
|
if (is_plus)
|
||||||
|
{
|
||||||
|
entry->name_attributes = (post_op_attr){
|
||||||
|
.attributes_follow = 1,
|
||||||
|
.attributes = get_dir_attributes(self, dir_id_it->first),
|
||||||
|
};
|
||||||
|
entry->name_handle = (post_op_fh3){
|
||||||
|
.handle_follows = 1,
|
||||||
|
.handle = xdr_copy_string(rop->xdrs, "S"+base64_encode(sha256(dir_id_it->first))),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void nfs3_readdir_common(void *opaque, rpc_op_t *rop, bool is_plus)
|
static void nfs3_readdir_common(void *opaque, rpc_op_t *rop, bool is_plus)
|
||||||
{
|
{
|
||||||
nfs_client_t *self = (nfs_client_t*)opaque;
|
nfs_client_t *self = (nfs_client_t*)opaque;
|
||||||
@@ -958,17 +1057,17 @@ static void nfs3_readdir_common(void *opaque, rpc_op_t *rop, bool is_plus)
|
|||||||
continue;
|
continue;
|
||||||
std::string subname = dir_id_it->first.substr(prefix.size());
|
std::string subname = dir_id_it->first.substr(prefix.size());
|
||||||
// for directories, fileid changes when the user restarts proxy
|
// for directories, fileid changes when the user restarts proxy
|
||||||
entries[subname].fileid = dir_id_it->second.id;
|
fill_dir_entry(self, rop, dir_id_it, &entries[subname], is_plus);
|
||||||
if (is_plus)
|
}
|
||||||
|
// Add . and ..
|
||||||
|
{
|
||||||
|
auto dir_id_it = self->parent->dir_info.find(dir);
|
||||||
|
fill_dir_entry(self, rop, dir_id_it, &entries["."], is_plus);
|
||||||
|
auto sl = dir.rfind("/");
|
||||||
|
if (sl != std::string::npos)
|
||||||
{
|
{
|
||||||
entries[subname].name_attributes = (post_op_attr){
|
auto dir_id_it = self->parent->dir_info.find(dir.substr(0, sl));
|
||||||
.attributes_follow = 1,
|
fill_dir_entry(self, rop, dir_id_it, &entries[".."], is_plus);
|
||||||
.attributes = get_dir_attributes(self, dir_id_it->first),
|
|
||||||
};
|
|
||||||
entries[subname].name_handle = (post_op_fh3){
|
|
||||||
.handle_follows = 1,
|
|
||||||
.handle = xdr_copy_string(rop->xdrs, "S"+base64_encode(sha256(dir_id_it->first))),
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Offset results by the continuation cookie (equal to index in the listing)
|
// Offset results by the continuation cookie (equal to index in the listing)
|
||||||
@@ -1193,10 +1292,11 @@ static int nfs3_commit_proc(void *opaque, rpc_op_t *rop)
|
|||||||
cluster_op_t *op = new cluster_op_t;
|
cluster_op_t *op = new cluster_op_t;
|
||||||
// fsync. we don't know how to fsync a single inode, so just fsync everything
|
// fsync. we don't know how to fsync a single inode, so just fsync everything
|
||||||
op->opcode = OSD_OP_SYNC;
|
op->opcode = OSD_OP_SYNC;
|
||||||
op->callback = [rop](cluster_op_t *op)
|
op->callback = [self, rop](cluster_op_t *op)
|
||||||
{
|
{
|
||||||
COMMIT3res *reply = (COMMIT3res*)rop->reply;
|
COMMIT3res *reply = (COMMIT3res*)rop->reply;
|
||||||
*reply = (COMMIT3res){ .status = vitastor_nfs_map_err(op->retval) };
|
*reply = (COMMIT3res){ .status = vitastor_nfs_map_err(op->retval) };
|
||||||
|
*(uint64_t*)reply->resok.verf = self->parent->server_id;
|
||||||
rpc_queue_reply(rop);
|
rpc_queue_reply(rop);
|
||||||
};
|
};
|
||||||
self->parent->cli->execute(op);
|
self->parent->cli->execute(op);
|
||||||
|
|||||||
@@ -86,6 +86,28 @@ struct rpc_free_buffer_t
|
|||||||
unsigned size;
|
unsigned size;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct extend_size_t
|
||||||
|
{
|
||||||
|
inode_t inode;
|
||||||
|
uint64_t new_size;
|
||||||
|
};
|
||||||
|
|
||||||
|
inline bool operator < (const extend_size_t &a, const extend_size_t &b)
|
||||||
|
{
|
||||||
|
return a.inode < b.inode || a.inode == b.inode && a.new_size < b.new_size;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct extend_write_t
|
||||||
|
{
|
||||||
|
rpc_op_t *rop;
|
||||||
|
int resize_res, write_res; // 1 = started, 0 = completed OK, -errno = completed with error
|
||||||
|
};
|
||||||
|
|
||||||
|
struct extend_inode_t
|
||||||
|
{
|
||||||
|
uint64_t cur_extend = 0, next_extend = 0;
|
||||||
|
};
|
||||||
|
|
||||||
class nfs_client_t
|
class nfs_client_t
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -100,6 +122,8 @@ public:
|
|||||||
rpc_cur_buffer_t cur_buffer = { 0 };
|
rpc_cur_buffer_t cur_buffer = { 0 };
|
||||||
std::map<uint8_t*, rpc_used_buffer_t> used_buffers;
|
std::map<uint8_t*, rpc_used_buffer_t> used_buffers;
|
||||||
std::vector<rpc_free_buffer_t> free_buffers;
|
std::vector<rpc_free_buffer_t> free_buffers;
|
||||||
|
std::map<inode_t, extend_inode_t> extends;
|
||||||
|
std::multimap<extend_size_t, extend_write_t> extend_writes;
|
||||||
|
|
||||||
iovec read_iov;
|
iovec read_iov;
|
||||||
msghdr read_msg = { 0 };
|
msghdr read_msg = { 0 };
|
||||||
|
|||||||
+1
-4
@@ -240,10 +240,7 @@ static void vitastor_uring_handler(void *opaque)
|
|||||||
VitastorClient *client = (VitastorClient*)opaque;
|
VitastorClient *client = (VitastorClient*)opaque;
|
||||||
qemu_mutex_lock(&client->mutex);
|
qemu_mutex_lock(&client->mutex);
|
||||||
client->bh_uring_scheduled = 0;
|
client->bh_uring_scheduled = 0;
|
||||||
do
|
vitastor_c_uring_handle_events(client->proxy);
|
||||||
{
|
|
||||||
vitastor_c_uring_handle_events(client->proxy);
|
|
||||||
} while (vitastor_c_uring_has_work(client->proxy));
|
|
||||||
qemu_mutex_unlock(&client->mutex);
|
qemu_mutex_unlock(&client->mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+11
-1
@@ -66,6 +66,16 @@ void ring_loop_t::unregister_consumer(ring_consumer_t *consumer)
|
|||||||
|
|
||||||
void ring_loop_t::loop()
|
void ring_loop_t::loop()
|
||||||
{
|
{
|
||||||
|
if (ring_eventfd >= 0)
|
||||||
|
{
|
||||||
|
// Reset eventfd counter
|
||||||
|
uint64_t ctr = 0;
|
||||||
|
int r = read(ring_eventfd, &ctr, 8);
|
||||||
|
if (r < 0 && errno != EAGAIN && errno != EINTR)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "Error resetting eventfd: %s\n", strerror(errno));
|
||||||
|
}
|
||||||
|
}
|
||||||
struct io_uring_cqe *cqe;
|
struct io_uring_cqe *cqe;
|
||||||
while (!io_uring_peek_cqe(&ring, &cqe))
|
while (!io_uring_peek_cqe(&ring, &cqe))
|
||||||
{
|
{
|
||||||
@@ -84,7 +94,7 @@ void ring_loop_t::loop()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
printf("Warning: empty callback in SQE\n");
|
fprintf(stderr, "Warning: empty callback in SQE\n");
|
||||||
free_ring_data[free_ring_data_ptr++] = d - ring_datas;
|
free_ring_data[free_ring_data_ptr++] = d - ring_datas;
|
||||||
}
|
}
|
||||||
io_uring_cqe_seen(&ring, cqe);
|
io_uring_cqe_seen(&ring, cqe);
|
||||||
|
|||||||
@@ -308,3 +308,19 @@ std::string str_repeat(const std::string & str, int times)
|
|||||||
r += str;
|
r += str;
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
size_t utf8_length(const std::string & s)
|
||||||
|
{
|
||||||
|
size_t len = 0;
|
||||||
|
for (size_t i = 0; i < s.size(); i++)
|
||||||
|
len += (s[i] & 0xC0) != 0x80;
|
||||||
|
return len;
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t utf8_length(const char *s)
|
||||||
|
{
|
||||||
|
size_t len = 0;
|
||||||
|
for (; *s; s++)
|
||||||
|
len += (*s & 0xC0) != 0x80;
|
||||||
|
return len;
|
||||||
|
}
|
||||||
|
|||||||
@@ -18,3 +18,5 @@ void print_help(const char *help_text, std::string exe_name, std::string cmd, bo
|
|||||||
uint64_t parse_time(std::string time_str, bool *ok = NULL);
|
uint64_t parse_time(std::string time_str, bool *ok = NULL);
|
||||||
std::string read_all_fd(int fd);
|
std::string read_all_fd(int fd);
|
||||||
std::string str_repeat(const std::string & str, int times);
|
std::string str_repeat(const std::string & str, int times);
|
||||||
|
size_t utf8_length(const std::string & s);
|
||||||
|
size_t utf8_length(const char *s);
|
||||||
|
|||||||
+1
-1
@@ -6,7 +6,7 @@ includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@
|
|||||||
|
|
||||||
Name: Vitastor
|
Name: Vitastor
|
||||||
Description: Vitastor client library
|
Description: Vitastor client library
|
||||||
Version: 0.9.4
|
Version: 0.9.6
|
||||||
Libs: -L${libdir} -lvitastor_client
|
Libs: -L${libdir} -lvitastor_client
|
||||||
Cflags: -I${includedir}
|
Cflags: -I${includedir}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user