1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-03-10 16:58:47 +03:00

add mda arg to add_mda

Allow the caller of lvmcache_add_mda() to have the
new mda returned.
This commit is contained in:
David Teigland 2019-02-05 13:24:23 -06:00
parent b2447e3538
commit 889b5d3183
5 changed files with 13 additions and 7 deletions

View File

@ -2086,9 +2086,10 @@ void lvmcache_del_bas(struct lvmcache_info *info)
}
int lvmcache_add_mda(struct lvmcache_info *info, struct device *dev,
uint64_t start, uint64_t size, unsigned ignored)
uint64_t start, uint64_t size, unsigned ignored,
struct metadata_area **mda_new)
{
return add_mda(info->fmt, NULL, &info->mdas, dev, start, size, ignored);
return add_mda(info->fmt, NULL, &info->mdas, dev, start, size, ignored, mda_new);
}
int lvmcache_add_da(struct lvmcache_info *info, uint64_t start, uint64_t size)

View File

@ -129,7 +129,8 @@ void lvmcache_del_mdas(struct lvmcache_info *info);
void lvmcache_del_das(struct lvmcache_info *info);
void lvmcache_del_bas(struct lvmcache_info *info);
int lvmcache_add_mda(struct lvmcache_info *info, struct device *dev,
uint64_t start, uint64_t size, unsigned ignored);
uint64_t start, uint64_t size, unsigned ignored,
struct metadata_area **mda_new);
int lvmcache_add_da(struct lvmcache_info *info, uint64_t start, uint64_t size);
int lvmcache_add_ba(struct lvmcache_info *info, uint64_t start, uint64_t size);

View File

@ -1547,7 +1547,7 @@ static int _text_pv_write(const struct format_type *fmt, struct physical_volume
// if fmt is not the same as info->fmt we are in trouble
if (!lvmcache_add_mda(info, mdac->area.dev,
mdac->area.start, mdac->area.size,
mda_is_ignored(mda)))
mda_is_ignored(mda), NULL))
return_0;
}

View File

@ -61,7 +61,8 @@ int add_ba(struct dm_pool *mem, struct dm_list *eas,
uint64_t start, uint64_t size);
void del_bas(struct dm_list *bas);
int add_mda(const struct format_type *fmt, struct dm_pool *mem, struct dm_list *mdas,
struct device *dev, uint64_t start, uint64_t size, unsigned ignored);
struct device *dev, uint64_t start, uint64_t size, unsigned ignored,
struct metadata_area **mda_new);
void del_mdas(struct dm_list *mdas);
/* On disk */

View File

@ -243,7 +243,8 @@ void del_bas(struct dm_list *bas)
/* FIXME: refactor this function with other mda constructor code */
int add_mda(const struct format_type *fmt, struct dm_pool *mem, struct dm_list *mdas,
struct device *dev, uint64_t start, uint64_t size, unsigned ignored)
struct device *dev, uint64_t start, uint64_t size, unsigned ignored,
struct metadata_area **mda_new)
{
/* FIXME List size restricted by pv_header SECTOR_SIZE */
struct metadata_area *mdal, *mda;
@ -295,6 +296,8 @@ int add_mda(const struct format_type *fmt, struct dm_pool *mem, struct dm_list *
mda_set_ignored(mdal, ignored);
dm_list_add(mdas, &mdal->list);
if (mda_new)
*mda_new = mdal;
return 1;
}
@ -408,7 +411,7 @@ static int _text_read(struct labeller *l, struct device *dev, void *label_buf,
/* Metadata area headers */
dlocn_xl++;
while ((offset = xlate64(dlocn_xl->offset))) {
lvmcache_add_mda(info, dev, offset, xlate64(dlocn_xl->size), 0);
lvmcache_add_mda(info, dev, offset, xlate64(dlocn_xl->size), 0, NULL);
dlocn_xl++;
}