Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
iSulad
提交
b9353240
I
iSulad
项目概览
openeuler
/
iSulad
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
I
iSulad
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
b9353240
编写于
7月 23, 2020
作者:
G
gaohuatao
提交者:
lifeng68
7月 25, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
devmapper: enable deferred delete in default
Signed-off-by:
N
gaohuatao
<
gaohuatao@huawei.com
>
上级
c7024b8d
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
38 addition
and
135 deletion
+38
-135
src/daemon/modules/image/oci/storage/layer_store/graphdriver/devmapper/devices_constants.h
...age/layer_store/graphdriver/devmapper/devices_constants.h
+0
-5
src/daemon/modules/image/oci/storage/layer_store/graphdriver/devmapper/deviceset.c
...oci/storage/layer_store/graphdriver/devmapper/deviceset.c
+38
-122
src/daemon/modules/image/oci/storage/layer_store/graphdriver/devmapper/driver_devmapper.c
...rage/layer_store/graphdriver/devmapper/driver_devmapper.c
+0
-5
src/daemon/modules/image/oci/storage/layer_store/graphdriver/devmapper/driver_devmapper.h
...rage/layer_store/graphdriver/devmapper/driver_devmapper.h
+0
-2
src/daemon/modules/image/oci/storage/layer_store/graphdriver/driver.c
...odules/image/oci/storage/layer_store/graphdriver/driver.c
+0
-1
未找到文件。
src/daemon/modules/image/oci/storage/layer_store/graphdriver/devmapper/devices_constants.h
浏览文件 @
b9353240
...
...
@@ -64,8 +64,6 @@ struct device_set {
image_devmapper_transaction
*
metadata_trans
;
bool
override_udev_sync_check
;
bool
deferred_remove
;
bool
deferred_delete
;
char
*
base_device_uuid
;
char
*
base_device_filesystem
;
uint
nr_deleted_devices
;
// number of deleted devices
...
...
@@ -73,9 +71,6 @@ struct device_set {
char
*
xfs_nospace_retries
;
// max retries when xfs receives ENOSPC
int64_t
udev_wait_timeout
;
bool
driver_deferred_removal_support
;
bool
enable_deferred_removal
;
bool
enable_deferred_deletion
;
bool
user_base_size
;
};
...
...
src/daemon/modules/image/oci/storage/layer_store/graphdriver/devmapper/deviceset.c
浏览文件 @
b9353240
...
...
@@ -174,22 +174,6 @@ out:
return
0
;
}
static
int
enable_deferred_removal_deletion
(
struct
device_set
*
devset
)
{
if
(
devset
->
enable_deferred_removal
)
{
devset
->
deferred_remove
=
true
;
}
if
(
devset
->
enable_deferred_deletion
)
{
if
(
!
devset
->
deferred_remove
)
{
ERROR
(
"devmapper: Deferred deletion can not be enabled as deferred removal is not enabled."
);
return
-
1
;
}
devset
->
deferred_delete
=
true
;
}
return
0
;
}
static
char
*
metadata_dir
(
struct
device_set
*
devset
)
{
char
*
dir
=
NULL
;
...
...
@@ -297,38 +281,7 @@ out:
return
dev_name
;
}
static
int
remove_device
(
const
char
*
name
)
{
int
i
=
0
;
int
max_retry
=
200
;
int
ret
=
0
;
if
(
name
==
NULL
)
{
ERROR
(
"Invalid input"
);
return
-
1
;
}
for
(;
i
<
max_retry
;
i
++
)
{
ret
=
dev_delete_device_force
(
name
);
if
(
ret
==
0
)
{
DEBUG
(
"devmapper: remove device:%s success"
,
name
);
goto
out
;
}
if
(
ret
!=
ERR_BUSY
)
{
ERROR
(
"devmapper: remove device err,cause is not busy,stop retry"
);
goto
out
;
}
INFO
(
"devmapper: device is busy so we cannot remove, after 0.1s to retry"
);
sleep
(
0
.
1
);
}
out:
return
ret
;
}
static
int
deactivate_device_mode
(
struct
device_set
*
devset
,
image_devmapper_device_info
*
dev_info
,
bool
deferred_remove
)
static
int
deactivate_device_mode
(
struct
device_set
*
devset
,
image_devmapper_device_info
*
dev_info
)
{
int
ret
=
0
;
int
nret
=
0
;
...
...
@@ -358,7 +311,6 @@ static int deactivate_device_mode(struct device_set *devset, image_devmapper_dev
goto
free_out
;
}
if
(
deferred_remove
)
{
nret
=
dev_remove_device_deferred
(
dm_name
);
if
(
nret
!=
0
)
{
if
(
nret
==
ERR_ENXIO
)
{
...
...
@@ -369,18 +321,6 @@ static int deactivate_device_mode(struct device_set *devset, image_devmapper_dev
ERROR
(
"devmapper: remove device:%s failed, err:%s"
,
dm_name
,
dev_strerror
(
nret
));
goto
free_out
;
}
}
else
{
nret
=
remove_device
(
dm_name
);
if
(
nret
!=
0
)
{
if
(
nret
==
ERR_ENXIO
)
{
WARN
(
"devmapper: device %s has gone"
,
dm_name
);
goto
free_out
;
}
ret
=
-
1
;
ERROR
(
"devmapper: remove device:%s without deferred failed, err:%s"
,
dm_name
,
dev_strerror
(
nret
));
goto
free_out
;
}
}
free_out:
free
(
dm_name
);
...
...
@@ -389,7 +329,7 @@ free_out:
static
int
deactivate_device
(
struct
device_set
*
devset
,
image_devmapper_device_info
*
dev_info
)
{
return
deactivate_device_mode
(
devset
,
dev_info
,
devset
->
deferred_remove
);
return
deactivate_device_mode
(
devset
,
dev_info
);
}
static
int
pool_status
(
struct
device_set
*
devset
,
uint64_t
*
total_size_in_sectors
,
uint64_t
*
transaction_id
,
...
...
@@ -1672,7 +1612,7 @@ static int take_snapshot(struct device_set *devset, const char *hash, image_devm
goto
out
;
}
if
(
devset
->
deferred_remove
)
{
if
(
dev_get_info_with_deferred
(
dm_name
,
dmi
)
!=
0
)
{
ret
=
-
1
;
goto
out
;
...
...
@@ -1689,10 +1629,7 @@ static int take_snapshot(struct device_set *devset, const char *hash, image_devm
deactive_dev
=
true
;
}
}
}
else
if
(
dev_get_info
(
dmi
,
dm_name
)
!=
0
)
{
ret
=
-
1
;
goto
out
;
}
if
(
dmi
!=
NULL
&&
dmi
->
exists
!=
0
)
{
if
(
dev_suspend_device
(
dm_name
)
!=
0
)
{
...
...
@@ -1728,10 +1665,6 @@ static int cancel_deferred_removal_if_needed(struct device_set *devset, image_de
char
*
dm_name
=
NULL
;
struct
dm_info
dmi
=
{
0
};
if
(
!
devset
->
deferred_remove
)
{
return
0
;
}
dm_name
=
get_dm_name
(
devset
,
info
->
hash
);
if
(
dm_name
==
NULL
)
{
ret
=
-
1
;
...
...
@@ -1739,7 +1672,6 @@ static int cancel_deferred_removal_if_needed(struct device_set *devset, image_de
goto
out
;
}
DEBUG
(
"devmapper: cancelDeferredRemovalIfNeeded START(%s)"
,
dm_name
);
if
(
dev_get_info_with_deferred
(
dm_name
,
&
dmi
)
!=
0
)
{
ret
=
-
1
;
ERROR
(
"devmapper: can not get info from dm %s"
,
dm_name
);
...
...
@@ -2260,7 +2192,7 @@ static int delete_transaction(struct device_set *devset, image_devmapper_device_
pool_fname
=
get_pool_dev_name
(
devset
);
nret
=
dev_delete_device
(
pool_fname
,
info
->
device_id
);
if
(
nret
!=
0
)
{
if
(
sync_delete
||
!
devset
->
deferred_delete
||
nret
!=
ERR_BUSY
)
{
if
(
sync_delete
||
nret
!=
ERR_BUSY
)
{
ERROR
(
"devmapper: Error deleting device"
);
ret
=
-
1
;
goto
out
;
...
...
@@ -2293,7 +2225,6 @@ out:
static
int
do_delete_device
(
struct
device_set
*
devset
,
const
char
*
hash
,
bool
sync_delete
)
{
int
ret
=
0
;
bool
deferred_remove
=
false
;
devmapper_device_info_t
*
device_info
=
NULL
;
if
(
devset
==
NULL
||
hash
==
NULL
)
{
...
...
@@ -2306,12 +2237,7 @@ static int do_delete_device(struct device_set *devset, const char *hash, bool sy
return
-
1
;
}
deferred_remove
=
devset
->
deferred_remove
;
if
(
!
devset
->
deferred_delete
)
{
deferred_remove
=
false
;
}
if
(
deactivate_device_mode
(
devset
,
device_info
->
info
,
deferred_remove
)
!=
0
)
{
if
(
deactivate_device_mode
(
devset
,
device_info
->
info
)
!=
0
)
{
ret
=
-
1
;
ERROR
(
"devmapper: Error deactivating device"
);
goto
out
;
...
...
@@ -2505,12 +2431,6 @@ static int do_devmapper_init(struct device_set *devset)
bool
support
=
false
;
char
*
metadata_path
=
NULL
;
if
(
enable_deferred_removal_deletion
(
devset
)
!=
0
)
{
ERROR
(
"devmapper: enable deferred remove failed"
);
ret
=
-
1
;
goto
out
;
}
support
=
udev_set_sync_support
(
true
);
if
(
!
support
)
{
ERROR
(
"devmapper: Udev sync is not supported. This will lead to data loss and unexpected behavior."
);
...
...
@@ -2597,12 +2517,15 @@ static int determine_driver_capabilities(const char *version, struct device_set
goto
out
;
}
if
(
major
>
4
)
{
devset
->
driver_deferred_removal_support
=
true
;
if
(
major
<
4
)
{
ERROR
(
"devicamapper driver version:(%ld.xxx) < 4.27.0, do not surpport deferred removal"
,
major
);
isulad_set_error_message
(
"devicamapper driver version:(%ld.xxx) < 4.27.0, do not surpport deferred removal"
,
major
);
ret
=
-
1
;
goto
out
;
}
if
(
major
<
4
)
{
if
(
major
>
4
)
{
DEBUG
(
"devicemapper driver version >= 4.27.0, surpport deferred removal"
);
goto
out
;
}
...
...
@@ -2611,13 +2534,14 @@ static int determine_driver_capabilities(const char *version, struct device_set
ERROR
(
"devmapper: invalid size: '%s': %s"
,
tmp_str
[
1
],
strerror
(
-
ret
));
goto
out
;
}
/*
* If major is 4 and minor is 27, then there is no need to
* check for patch level as it can not be less than 0.
*/
if
(
minor
>=
27
)
{
devset
->
driver_deferred_removal_support
=
true
;
if
(
minor
<
27
)
{
ERROR
(
"devicamapper driver version (4.%ld) < 4.27.0, , do not surpport deferred removal"
,
minor
);
isulad_set_error_message
(
"devicamapper driver version (4.%ld) < 4.27.0, , do not surpport deferred removal"
,
minor
);
ret
=
-
1
;
goto
out
;
}
...
...
@@ -2644,11 +2568,6 @@ static int devmapper_init_cap_by_version(struct device_set *devset)
goto
out
;
}
if
(
devset
->
driver_deferred_removal_support
)
{
devset
->
enable_deferred_deletion
=
true
;
devset
->
enable_deferred_removal
=
true
;
}
out:
free
(
version
);
return
ret
;
...
...
@@ -2670,9 +2589,6 @@ static int devmapper_init_devset(const char *driver_home, const char **options,
devset
->
root
=
util_strdup_s
(
driver_home
);
devset
->
user_base_size
=
false
;
devset
->
driver_deferred_removal_support
=
false
;
devset
->
enable_deferred_removal
=
false
;
devset
->
enable_deferred_deletion
=
false
;
devset
->
base_fs_size
=
10
*
SIZE_GB
;
devset
->
mkfs_args
=
NULL
;
devset
->
mkfs_args_len
=
0
;
...
...
@@ -3171,8 +3087,8 @@ struct status *device_set_status(struct device_set *devset)
st
->
data_file
=
util_strdup_s
(
devset
->
data_device
);
st
->
metadata_file
=
util_strdup_s
(
devset
->
metadata_device
);
st
->
udev_sync_supported
=
udev_sync_supported
();
st
->
deferred_remove_enabled
=
devset
->
deferred_remov
e
;
st
->
deferred_delete_enabled
=
devset
->
deferred_delet
e
;
st
->
deferred_remove_enabled
=
tru
e
;
st
->
deferred_delete_enabled
=
tru
e
;
st
->
deferred_deleted_device_count
=
devset
->
nr_deleted_devices
;
st
->
base_device_size
=
get_base_device_size
(
devset
);
st
->
base_device_fs
=
util_strdup_s
(
devset
->
base_device_filesystem
);
...
...
src/daemon/modules/image/oci/storage/layer_store/graphdriver/devmapper/driver_devmapper.c
浏览文件 @
b9353240
...
...
@@ -281,11 +281,6 @@ static void free_driver_mount_opts(struct driver_mount_opts *opts)
free
(
opts
);
}
bool
devmapper_layer_exists
(
const
char
*
id
,
const
struct
graphdriver
*
driver
)
{
return
has_device
(
id
,
driver
->
devset
);
}
int
devmapper_apply_diff
(
const
char
*
id
,
const
struct
graphdriver
*
driver
,
const
struct
io_read_wrapper
*
content
)
{
struct
driver_mount_opts
*
mount_opts
=
NULL
;
...
...
src/daemon/modules/image/oci/storage/layer_store/graphdriver/devmapper/driver_devmapper.h
浏览文件 @
b9353240
...
...
@@ -57,8 +57,6 @@ char *devmapper_mount_layer(const char *id, const struct graphdriver *driver,
int
devmapper_umount_layer
(
const
char
*
id
,
const
struct
graphdriver
*
driver
);
bool
devmapper_layer_exists
(
const
char
*
id
,
const
struct
graphdriver
*
driver
);
int
devmapper_apply_diff
(
const
char
*
id
,
const
struct
graphdriver
*
driver
,
const
struct
io_read_wrapper
*
content
);
int
devmapper_get_layer_metadata
(
const
char
*
id
,
const
struct
graphdriver
*
driver
,
json_map_string_string
*
map_info
);
...
...
src/daemon/modules/image/oci/storage/layer_store/graphdriver/driver.c
浏览文件 @
b9353240
...
...
@@ -64,7 +64,6 @@ static const struct graphdriver_ops g_devmapper_ops = {
.
rm_layer
=
devmapper_rm_layer
,
.
mount_layer
=
devmapper_mount_layer
,
.
umount_layer
=
devmapper_umount_layer
,
.
exists
=
devmapper_layer_exists
,
.
apply_diff
=
devmapper_apply_diff
,
.
get_layer_metadata
=
devmapper_get_layer_metadata
,
.
get_driver_status
=
devmapper_get_driver_status
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录