mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
Move compose_log_line() into mirror directory.
This commit is contained in:
parent
0c09c9d943
commit
197632009b
@ -1,5 +1,6 @@
|
||||
Version 2.01.15 -
|
||||
=================================
|
||||
Move compose_log_line() into mirror directory.
|
||||
Factor out _get_library_path().
|
||||
Don't kill idling clvmd threads.
|
||||
Recognise ATA over Ethernet (aoe) devices.
|
||||
|
@ -727,8 +727,8 @@ static int _emit_target_line(struct dev_manager *dm, struct dm_task *dmt,
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int _build_dev_string(struct dev_manager *dm, char *dlid,
|
||||
char *devbuf, size_t bufsize, const char *desc)
|
||||
int build_dev_string(struct dev_manager *dm, char *dlid, char *devbuf,
|
||||
size_t bufsize, const char *desc)
|
||||
{
|
||||
struct dev_layer *dl;
|
||||
|
||||
@ -749,45 +749,6 @@ static int _build_dev_string(struct dev_manager *dm, char *dlid,
|
||||
return 1;
|
||||
}
|
||||
|
||||
int compose_log_line(struct dev_manager *dm, struct lv_segment *seg,
|
||||
char *params, size_t paramsize, int *pos, int areas,
|
||||
uint32_t region_size)
|
||||
{
|
||||
int tw;
|
||||
char devbuf[10];
|
||||
char *name;
|
||||
|
||||
if (!seg->log_lv)
|
||||
tw = lvm_snprintf(params, paramsize, "core 1 %u %u ",
|
||||
region_size, areas);
|
||||
else {
|
||||
if (!(name = build_dm_name(dm->mem, seg->log_lv->vg->name,
|
||||
seg->log_lv->name, NULL))) {
|
||||
stack;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!_build_dev_string(dm, seg->log_lv->lvid.s, devbuf,
|
||||
sizeof(devbuf), "log")) {
|
||||
stack;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* FIXME add sync parm? */
|
||||
tw = lvm_snprintf(params, paramsize, "disk 2 %s %u %u ",
|
||||
devbuf, region_size, areas);
|
||||
}
|
||||
|
||||
if (tw < 0) {
|
||||
stack;
|
||||
return -1;
|
||||
}
|
||||
|
||||
*pos += tw;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int compose_areas_line(struct dev_manager *dm, struct lv_segment *seg,
|
||||
char *params, size_t paramsize, int *pos, int start_area,
|
||||
int areas)
|
||||
@ -816,8 +777,8 @@ int compose_areas_line(struct dev_manager *dm, struct lv_segment *seg,
|
||||
(esize * seg_pe(seg, s))),
|
||||
trailing_space);
|
||||
else if (seg_type(seg, s) == AREA_LV) {
|
||||
if (!_build_dev_string(dm, seg_lv(seg, s)->lvid.s, devbuf,
|
||||
sizeof(devbuf), "LV")) {
|
||||
if (!build_dev_string(dm, seg_lv(seg, s)->lvid.s, devbuf,
|
||||
sizeof(devbuf), "LV")) {
|
||||
stack;
|
||||
return 0;
|
||||
}
|
||||
@ -901,7 +862,7 @@ static int _populate_origin(struct dev_manager *dm,
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!_build_dev_string(dm, real, params, sizeof(params), "origin")) {
|
||||
if (!build_dev_string(dm, real, params, sizeof(params), "origin")) {
|
||||
stack;
|
||||
return 0;
|
||||
}
|
||||
@ -942,13 +903,12 @@ static int _populate_snapshot(struct dev_manager *dm,
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!_build_dev_string(dm, origin, devbufo, sizeof(devbufo),
|
||||
"origin")) {
|
||||
if (!build_dev_string(dm, origin, devbufo, sizeof(devbufo), "origin")) {
|
||||
stack;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!_build_dev_string(dm, cow, devbufc, sizeof(devbufc), "cow")) {
|
||||
if (!build_dev_string(dm, cow, devbufc, sizeof(devbufc), "cow")) {
|
||||
stack;
|
||||
return 0;
|
||||
}
|
||||
|
@ -23,8 +23,7 @@ int compose_areas_line(struct dev_manager *dm, struct lv_segment *seg,
|
||||
char *params, size_t paramsize, int *pos,
|
||||
int start_area, int areas);
|
||||
|
||||
int compose_log_line(struct dev_manager *dm, struct lv_segment *seg,
|
||||
char *params, size_t paramsize, int *pos, int areas,
|
||||
uint32_t region_size);
|
||||
int build_dev_string(struct dev_manager *dm, char *dlid, char *devbuf,
|
||||
size_t bufsize, const char *desc);
|
||||
|
||||
#endif
|
||||
|
@ -165,6 +165,38 @@ static struct mirror_state *_init_target(struct pool *mem,
|
||||
return mirr_state;
|
||||
}
|
||||
|
||||
static int _compose_log_line(struct dev_manager *dm, struct lv_segment *seg,
|
||||
char *params, size_t paramsize, int *pos,
|
||||
int areas, uint32_t region_size)
|
||||
{
|
||||
int tw;
|
||||
char devbuf[10];
|
||||
|
||||
if (!seg->log_lv)
|
||||
tw = lvm_snprintf(params, paramsize, "core 1 %u %u ",
|
||||
region_size, areas);
|
||||
else {
|
||||
if (!build_dev_string(dm, seg->log_lv->lvid.s, devbuf,
|
||||
sizeof(devbuf), "log")) {
|
||||
stack;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* FIXME add sync parm? */
|
||||
tw = lvm_snprintf(params, paramsize, "disk 2 %s %u %u ",
|
||||
devbuf, region_size, areas);
|
||||
}
|
||||
|
||||
if (tw < 0) {
|
||||
stack;
|
||||
return -1;
|
||||
}
|
||||
|
||||
*pos += tw;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int _compose_target_line(struct dev_manager *dm, struct pool *mem,
|
||||
struct config_tree *cft, void **target_state,
|
||||
struct lv_segment *seg, char *params,
|
||||
@ -220,8 +252,8 @@ static int _compose_target_line(struct dev_manager *dm, struct pool *mem,
|
||||
}
|
||||
}
|
||||
|
||||
if ((ret = compose_log_line(dm, seg, params, paramsize, pos,
|
||||
areas, region_size)) <= 0) {
|
||||
if ((ret = _compose_log_line(dm, seg, params, paramsize, pos,
|
||||
areas, region_size)) <= 0) {
|
||||
stack;
|
||||
return ret;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user