master - [io paths] Unpick agk's aio stuff
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=00f1b208a1bf44665ec97a791355b1fcf525a3a7 Commit: 00f1b208a1bf44665ec97a791355b1fcf525a3a7 Parent: d51429254f4e9b17083af0c554aa7045e5ec08bb Author: Joe Thornber <[email protected]> AuthorDate: Fri Apr 20 10:43:50 2018 -0500 Committer: David Teigland <[email protected]> CommitterDate: Fri Apr 20 11:03:58 2018 -0500
[io paths] Unpick agk's aio stuff
--- conf/example.conf.in | 16 - configure.in | 22 -- doc/aio_design.txt | 215 -------------- include/configure.h.in | 3 - lib/cache/lvmcache.c | 51 +--- lib/cache/lvmcache.h | 2 +- lib/cache/lvmetad.c | 2 +- lib/commands/toolcontext.c | 16 +- lib/commands/toolcontext.h | 1 - lib/config/config.c | 154 ++++------- lib/config/config.h | 8 +- lib/config/config_settings.h | 10 - lib/config/defaults.h | 3 - lib/device/dev-cache.c | 12 - lib/device/dev-cache.h | 8 +- lib/device/dev-io.c | 600 ++++++--------------------------------- lib/device/dev-luks.c | 2 +- lib/device/dev-md.c | 2 +- lib/device/dev-swap.c | 3 +- lib/device/dev-type.c | 2 +- lib/device/device.h | 102 ++----- lib/filters/filter-composite.c | 4 +- lib/filters/filter-persistent.c | 8 +- lib/filters/filter.h | 2 +- lib/format1/disk-rep.c | 10 +- lib/format1/format1.c | 2 +- lib/format1/lvm1-label.c | 19 +- lib/format_pool/disk_rep.c | 2 +- lib/format_pool/format_pool.c | 2 +- lib/format_pool/pool_label.c | 13 +- lib/format_text/archive.c | 4 +- lib/format_text/archiver.c | 2 +- lib/format_text/export.c | 21 +- lib/format_text/format-text.c | 541 ++++++++++------------------------- lib/format_text/import-export.h | 8 +- lib/format_text/import.c | 233 +++++----------- lib/format_text/layout.h | 12 +- lib/format_text/text_label.c | 197 +++---------- lib/label/label.c | 173 ++++-------- lib/label/label.h | 6 +- lib/metadata/metadata-liblvm.c | 3 +- lib/metadata/metadata.c | 8 +- lib/metadata/metadata.h | 5 +- make.tmpl.in | 3 +- tools/command.c | 11 +- tools/toollib.c | 1 - 46 files changed, 565 insertions(+), 1959 deletions(-)
conf/example.conf.in +0 -16
@@ -59,22 +59,6 @@ devices { # This configuration option is advanced. scan = [ "/dev" ] - # Configuration option devices/use_aio. - # Use linux asynchronous I/O for parallel device access where possible. - # This configuration option has an automatic default value. - # use_aio = 1 - - # Configuration option devices/aio_max. - # Maximum number of asynchronous I/Os to issue concurrently. - # This configuration option has an automatic default value. - # aio_max = 128 - - # Configuration option devices/aio_memory. - # Approximate maximum total amount of memory (in MB) used - # for asynchronous I/O buffers. - # This configuration option has an automatic default value. - # aio_memory = 10 - # Configuration option devices/obtain_device_list_from_udev. # Obtain the list of available devices from udev. # This avoids opening or using any inapplicable non-block devices or
configure.in +0 -22
@@ -39,7 +39,6 @@ case "$host_os" in LDDEPS="$LDDEPS .export.sym" LIB_SUFFIX=so DEVMAPPER=yes - AIO=yes BUILD_LVMETAD=no BUILD_LVMPOLLD=no LOCKDSANLOCK=no
@@ -59,7 +58,6 @@ case "$host_os" in CLDNOWHOLEARCHIVE= LIB_SUFFIX=dylib DEVMAPPER=yes - AIO=no ODIRECT=no DM_IOCTLS=no SELINUX=no
@@ -1125,24 +1123,6 @@ if test "$DEVMAPPER" = yes; then fi ################################################################################ -dnl -- Disable aio -AC_MSG_CHECKING(whether to use asynchronous I/O) -AC_ARG_ENABLE(aio, - AC_HELP_STRING([--disable-aio], - [disable asynchronous I/O]), - AIO=$enableval) -AC_MSG_RESULT($AIO) - -if test "$AIO" = yes; then - AC_CHECK_LIB(aio, io_setup, - [AC_DEFINE([AIO_SUPPORT], 1, [Define to 1 if aio is available.]) - AIO_LIBS="-laio" - AIO_SUPPORT=yes], - [AIO_LIBS= - AIO_SUPPORT=no ]) -fi - -################################################################################ dnl -- Build lvmetad AC_MSG_CHECKING(whether to build LVMetaD) AC_ARG_ENABLE(lvmetad,
@@ -2081,11 +2061,9 @@ AC_SUBST(DEFAULT_USE_LVMETAD) AC_SUBST(DEFAULT_USE_LVMPOLLD) AC_SUBST(DEFAULT_USE_LVMLOCKD) AC_SUBST(DEVMAPPER) -AC_SUBST(AIO) AC_SUBST(DLM_CFLAGS) AC_SUBST(DLM_LIBS) AC_SUBST(DL_LIBS) -AC_SUBST(AIO_LIBS) AC_SUBST(DMEVENTD_PATH) AC_SUBST(DM_LIB_PATCHLEVEL) AC_SUBST(ELDFLAGS)
doc/aio_design.txt deleted +0 -215
215 lines not on this page · raw message
include/configure.h.in +0 -3
@@ -1,8 +1,5 @@ /* include/configure.h.in. Generated from configure.in by autoheader. */ -/* Define to 1 if aio is available. */ -#undef AIO_SUPPORT - /* Define to 1 to use libblkid detection of signatures when wiping. */ #undef BLKID_WIPING_SUPPORT
lib/cache/lvmcache.c +13 -38
139 lines not on this page · raw message
lib/cache/lvmcache.h +1 -1
@@ -85,7 +85,7 @@ void lvmcache_del(struct lvmcache_info *info);/* Update things */ int lvmcache_update_vgname_and_id (struct lvmcache_info *info, -const struct lvmcache_vgsummary *vgsummary); +struct lvmcache_vgsummary *vgsummary);int lvmcache_update_vg (struct volume_group *vg,unsigned precommitted);void lvmcache_lock_vgname (const char *vgname,int read_only);
lib/cache/lvmetad.c +1 -1
@@ -1771,7 +1771,7 @@ static int _lvmetad_pvscan_single(struct metadata_area *mda, void *baton)struct volume_group *vg;if (mda_is_ignored (mda) || - !(vg = mda->ops->vg_read (b->fid,"" , mda,NULL ,NULL ,1 ,0 ))) + !(vg = mda->ops->vg_read (b->fid,"" , mda,NULL ,NULL ,1 )))return 1 ;/* FIXME Also ensure contents match etc. */
lib/commands/toolcontext.c +2 -14
@@ -636,16 +636,6 @@ static int _process_config(struct cmd_context *cmd)*/ cmd->default_settings.udev_fallback = udev_disabled ?1 :-1 ; -#ifdef AIO_SUPPORT - cmd->use_aio =find_config_tree_bool (cmd, devices_use_aio_CFG,NULL ); -#else - cmd->use_aio =0 ; -#endif -if (cmd->use_aio && !dev_async_setup (cmd)) - cmd->use_aio =0 ; - -log_debug_io ("%ssing asynchronous I/O." , cmd->use_aio ?"U" :"Not u" ); -init_retry_deactivation (find_config_tree_bool (cmd, activation_retry_deactivation_CFG,NULL ));init_activation_checks (find_config_tree_bool (cmd, activation_checks_CFG,NULL ));
@@ -1298,7 +1288,7 @@ int init_filters(struct cmd_context *cmd, unsigned load_persistent_cache)lvm_stat_ctim (&ts, &st); cts =config_file_timestamp (cmd->cft); if (timespeccmp(&ts, &cts, >) && - !persistent_filter_load (cmd->mem, cmd->filter,NULL )) + !persistent_filter_load (cmd->filter,NULL ))log_verbose ("Failed to load existing device cache from %s" , dev_cache); }
@@ -2160,8 +2150,6 @@ int refresh_toolcontext(struct cmd_context *cmd) cmd->lib_dir =NULL ; -label_init (); -if (!_init_lvm_conf (cmd)) return_0;
@@ -2249,7 +2237,7 @@ void destroy_toolcontext(struct cmd_context *cmd)int flags;if (cmd->dump_filter && cmd->filter && cmd->filter->dump && - !cmd->filter->dump (cmd->filter, cmd->mem,1 )) + !cmd->filter->dump (cmd->filter,1 )) stack;archive_exit (cmd);
lib/commands/toolcontext.h +0 -1
@@ -165,7 +165,6 @@ struct cmd_context { unsigned vg_notify:1; unsigned lv_notify:1; unsigned pv_notify:1; - unsigned use_aio:1; unsigned activate_component:1; /* command activates component LV */ unsigned process_component_lvs:1; /* command processes also component LVs */
lib/config/config.c +50 -104
213 lines not on this page · raw message
lib/config/config.h +3 -5
@@ -239,13 +239,11 @@ config_source_t config_get_source_type(struct dm_config_tree *cft);typedef uint32_t (*checksum_fn_t ) (uint32_t initial,const uint8_t *buf,uint32_t size);struct dm_config_tree *config_open (config_source_t source,const char *filename,int keep_open); -int config_file_read_fd (struct dm_pool *mem,struct dm_config_tree *cft,struct device *dev,dev_io_reason_t reason, +int config_file_read_fd (struct dm_config_tree *cft,struct device *dev,dev_io_reason_t reason,off_t offset,size_t size,off_t offset2,size_t size2,checksum_fn_t checksum_fn,uint32_t checksum, -int skip_parse,int no_dup_node_check,unsigned ioflags, -lvm_callback_fn_t config_file_read_fd_callback,void *config_file_read_fd_context); - -int config_file_read (struct dm_pool *mem,struct dm_config_tree *cft); +int skip_parse,int no_dup_node_check); +int config_file_read (struct dm_config_tree *cft);struct dm_config_tree *config_file_open_and_read (const char *config_file,config_source_t source,struct cmd_context *cmd); int config_write(struct dm_config_tree *cft, struct config_def_tree_spec *tree_spec,
lib/config/config_settings.h +0 -10
@@ -226,16 +226,6 @@ cfg(devices_dir_CFG, "dir", devices_CFG_SECTION, CFG_ADVANCED, CFG_TYPE_STRING,cfg_array (devices_scan_CFG,"scan" , devices_CFG_SECTION,CFG_ADVANCED ,CFG_TYPE_STRING ,"#S/dev" ,vsn (1 ,0 ,0 ),NULL ,0 ,NULL , "Directories containing device nodes to use with LVM.\n") -cfg (devices_use_aio_CFG,"use_aio" , devices_CFG_SECTION,CFG_DEFAULT_COMMENTED ,CFG_TYPE_BOOL ,DEFAULT_USE_AIO ,vsn (2 ,2 ,178 ),NULL ,0 ,NULL , - "Use linux asynchronous I/O for parallel device access where possible.\n") - -cfg (devices_aio_max_CFG,"aio_max" , devices_CFG_SECTION,CFG_DEFAULT_COMMENTED ,CFG_TYPE_INT ,DEFAULT_AIO_MAX ,vsn (2 ,2 ,178 ),NULL ,0 ,NULL , - "Maximum number of asynchronous I/Os to issue concurrently.\n") - -cfg (devices_aio_memory_CFG,"aio_memory" , devices_CFG_SECTION,CFG_DEFAULT_COMMENTED ,CFG_TYPE_INT ,DEFAULT_AIO_MEMORY ,vsn (2 ,2 ,178 ),NULL ,0 ,NULL , -"Approximate maximum total amount of memory (in MB) used\n" - "for asynchronous I/O buffers.\n") - cfg_array(devices_loopfiles_CFG, "loopfiles", devices_CFG_SECTION, CFG_DEFAULT_UNDEFINED | CFG_UNSUPPORTED, CFG_TYPE_STRING, NULL, vsn(1, 2, 0), NULL, 0, NULL, NULL) cfg(devices_obtain_device_list_from_udev_CFG, "obtain_device_list_from_udev", devices_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_OBTAIN_DEVICE_LIST_FROM_UDEV, vsn(2, 2, 85), NULL, 0, NULL,
lib/config/defaults.h +0 -3
@@ -32,9 +32,6 @@#define DEFAULT_SYSTEM_ID_SOURCE "none"#define DEFAULT_OBTAIN_DEVICE_LIST_FROM_UDEV 1#define DEFAULT_EXTERNAL_DEVICE_INFO_SOURCE "none" -#define DEFAULT_USE_AIO 1 -#define DEFAULT_AIO_MAX 128 -#define DEFAULT_AIO_MEMORY 10#define DEFAULT_SYSFS_SCAN 1#define DEFAULT_MD_COMPONENT_DETECTION 1#define DEFAULT_FW_RAID_COMPONENT_DETECTION 0
lib/device/dev-cache.c +0 -12
@@ -1245,24 +1245,12 @@ int dev_cache_check_for_open_devices(void)int dev_cache_exit (void ) { -struct btree_iter *b;int num_open =0 ; -dev_async_exit (); -if (_cache.names)if ((num_open =_check_for_open_devices (1 )) >0 )log_error (INTERNAL_ERROR "%d device(s) were left open and have been closed." , num_open); -if (_cache.devices) { -/* FIXME Replace with structured devbuf cache */ - b =btree_first (_cache.devices); -while (b) { -devbufs_release (btree_get_data (b)); - b =btree_next (b); - } - } -if (_cache.mem)dm_pool_destroy (_cache.mem);
lib/device/dev-cache.h +4 -4
@@ -23,10 +23,10 @@* predicate for devices. */ struct dev_filter { -int (*passes_filter) (struct dev_filter *f,struct device *dev); -void (*destroy) (struct dev_filter *f); -void (*wipe) (struct dev_filter *f); -int (*dump) (struct dev_filter *f,struct dm_pool *mem,int merge_existing); +int (*passes_filter) (struct dev_filter * f,struct device * dev); +void (*destroy) (struct dev_filter * f); +void (*wipe) (struct dev_filter * f); +int (*dump) (struct dev_filter * f,int merge_existing);void *private;unsigned use_count; };
lib/device/dev-io.c +89 -511
725 lines not on this page · raw message
lib/device/dev-luks.c +1 -1
@@ -31,7 +31,7 @@ int dev_is_luks(struct device *dev, uint64_t *offset_found)if (offset_found) *offset_found =0 ; -if (!dev_read_buf (dev,0 ,LUKS_SIGNATURE_SIZE ,DEV_IO_SIGNATURES , buf)) +if (!dev_read (dev,0 ,LUKS_SIGNATURE_SIZE ,DEV_IO_SIGNATURES , buf)) goto_out; ret =memcmp (buf,LUKS_SIGNATURE ,LUKS_SIGNATURE_SIZE ) ?0 :1 ;
lib/device/dev-md.c +1 -1
@@ -37,7 +37,7 @@ static int _dev_has_md_magic(struct device *dev, uint64_t sb_offset)uint32_t md_magic;/* Version 1 is little endian; version 0.90.0 is machine endian */ -if (dev_read_buf (dev, sb_offset,sizeof (uint32_t ),DEV_IO_SIGNATURES , &md_magic) && +if (dev_read (dev, sb_offset,sizeof (uint32_t ),DEV_IO_SIGNATURES , &md_magic) && ((md_magic ==MD_SB_MAGIC ) || ((MD_SB_MAGIC !=xlate32 (MD_SB_MAGIC )) && (md_magic ==xlate32 (MD_SB_MAGIC )))))return 1 ;
lib/device/dev-swap.c +2 -1
@@ -60,7 +60,8 @@ int dev_is_swap(struct device *dev, uint64_t *offset_found)continue ;if (size < (page >>SECTOR_SHIFT ))break ; -if (!dev_read_buf (dev, page -SIGNATURE_SIZE ,SIGNATURE_SIZE ,DEV_IO_SIGNATURES , buf)) { +if (!dev_read (dev, page -SIGNATURE_SIZE , +SIGNATURE_SIZE ,DEV_IO_SIGNATURES , buf)) { ret =-1 ;break ; }
lib/device/dev-type.c +1 -1
@@ -363,7 +363,7 @@ static int _has_partition_table(struct device *dev)uint16_t magic; } __attribute__((packed)) buf; /* sizeof() == SECTOR_SIZE */ -if (!dev_read_buf (dev,UINT64_C (0 ),sizeof (buf),DEV_IO_SIGNATURES , &buf)) +if (!dev_read (dev,UINT64_C (0 ),sizeof (buf),DEV_IO_SIGNATURES , &buf)) return_0;/* FIXME Check for other types of partition table too */
lib/device/device.h +25 -77
144 lines not on this page · raw message
lib/filters/filter-composite.c +2 -2
@@ -52,13 +52,13 @@ static void _composite_destroy(struct dev_filter *f)dm_free (f); } -static int _dump (struct dev_filter *f,struct dm_pool *mem,int merge_existing) +static int _dump (struct dev_filter *f,int merge_existing) {struct dev_filter **filters;for (filters = (struct dev_filter **) f->private; *filters; ++filters)if ((*filters)->dump && - !(*filters)->dump (*filters, mem, merge_existing)) + !(*filters)->dump (*filters, merge_existing)) return_0;return 1 ;
lib/filters/filter-persistent.c +4 -4
@@ -87,7 +87,7 @@ static int _read_array(struct pfilter *pf, struct dm_config_tree *cft,return 1 ; } -int persistent_filter_load (struct dm_pool *mem,struct dev_filter *f,struct dm_config_tree **cft_out) +int persistent_filter_load (struct dev_filter *f,struct dm_config_tree **cft_out) {struct pfilter *pf = (struct pfilter *) f->private;struct dm_config_tree *cft;
@@ -116,7 +116,7 @@ int persistent_filter_load(struct dm_pool *mem, struct dev_filter *f, struct dm_if (!(cft =config_open (CONFIG_FILE_SPECIAL , pf->file,1 ))) return_0; -if (!config_file_read (mem, cft)) +if (!config_file_read (cft)) goto_out;log_debug_devs ("Loading persistent filter cache from %s" , pf->file);
@@ -175,7 +175,7 @@ static void _write_array(struct pfilter *pf, FILE *fp, const char *path,fprintf (fp,"\n\t]\n" ); } -static int _persistent_filter_dump (struct dev_filter *f,struct dm_pool *mem,int merge_existing) +static int _persistent_filter_dump (struct dev_filter *f,int merge_existing) {struct pfilter *pf;char *tmp_file;
@@ -234,7 +234,7 @@ static int _persistent_filter_dump(struct dev_filter *f, struct dm_pool *mem, inlvm_stat_ctim (&ts, &info); if (merge_existing && timespeccmp(&ts, &pf->ctime, !=))/* Keep cft open to avoid losing lock */ -persistent_filter_load (mem, f, &cft); +persistent_filter_load (f, &cft); tmp_file =alloca (strlen (pf->file) +5 );sprintf (tmp_file,"%s.tmp" , pf->file);
lib/filters/filter.h +1 -1
@@ -53,6 +53,6 @@ typedef enum { } filter_mode_t;struct dev_filter *usable_filter_create (struct dev_types *dt,filter_mode_t mode); -int persistent_filter_load (struct dm_pool *mem,struct dev_filter *f,struct dm_config_tree **cft_out); +int persistent_filter_load (struct dev_filter *f,struct dm_config_tree **cft_out);#endif /* _LVM_FILTER_H */
lib/format1/disk-rep.c +5 -5
@@ -205,7 +205,7 @@ int munge_pvd(struct device *dev, struct pv_disk *pvd)static int _read_pvd (struct device *dev,struct pv_disk *pvd) { -if (!dev_read_buf (dev,UINT64_C (0 ),sizeof (*pvd),DEV_IO_FMT1 , pvd)) { +if (!dev_read (dev,UINT64_C (0 ),sizeof (*pvd),DEV_IO_FMT1 , pvd)) {log_very_verbose ("Failed to read PV data from %s" ,dev_name (dev));return 0 ;
@@ -216,7 +216,7 @@ static int _read_pvd(struct device *dev, struct pv_disk *pvd)static int _read_lvd (struct device *dev,uint64_t pos,struct lv_disk *disk) { -if (!dev_read_buf (dev, pos,sizeof (*disk),DEV_IO_FMT1 , disk)) +if (!dev_read (dev, pos,sizeof (*disk),DEV_IO_FMT1 , disk)) return_0;_xlate_lvd (disk);
@@ -228,7 +228,7 @@ int read_vgd(struct device *dev, struct vg_disk *vgd, struct pv_disk *pvd) {uint64_t pos = pvd->vg_on_disk.base; -if (!dev_read_buf (dev, pos,sizeof (*vgd),DEV_IO_FMT1 , vgd)) +if (!dev_read (dev, pos,sizeof (*vgd),DEV_IO_FMT1 , vgd)) return_0;_xlate_vgd (vgd);
@@ -252,7 +252,7 @@ static int _read_uuids(struct disk_list *data)uint64_t end = pos + data->pvd.pv_uuidlist_on_disk.size;while (pos < end && num_read < data->vgd.pv_cur) { -if (!dev_read_buf (data->dev, pos,sizeof (buffer),DEV_IO_FMT1 , buffer)) +if (!dev_read (data->dev, pos,sizeof (buffer),DEV_IO_FMT1 , buffer)) return_0;if (!(ul =dm_pool_alloc (data->mem,sizeof (*ul))))
@@ -311,7 +311,7 @@ static int _read_extents(struct disk_list *data)if (!extents) return_0; -if (!dev_read_buf (data->dev, pos, len,DEV_IO_FMT1 , extents)) +if (!dev_read (data->dev, pos, len,DEV_IO_FMT1 , extents)) return_0;_xlate_extents (extents, data->pvd.pe_total);
lib/format1/format1.c +1 -1
@@ -182,7 +182,7 @@ static struct volume_group *_format1_vg_read(struct format_instance *fid, struct metadata_area *mda __attribute__((unused)), struct cached_vg_fmtdata **vg_fmtdata __attribute__((unused)), unsigned *use_previous_vg __attribute__((unused)), - int single_device __attribute__((unused)), unsigned ioflags) + int single_device __attribute__((unused))) {struct volume_group *vg;struct disk_list *dl;
lib/format1/lvm1-label.c +5 -14
@@ -54,17 +54,15 @@ static int _lvm1_write(struct label *label __attribute__((unused)), void *buf __return 0 ; } -static int _lvm1_read (struct labeller *l,struct device *dev,void *buf,unsigned ioflags, -lvm_callback_fn_t read_label_callback_fn,void *read_label_callback_context) +static int _lvm1_read (struct labeller *l,struct device *dev,void *buf, +struct label **label) {struct pv_disk *pvd = (struct pv_disk *) buf;struct vg_disk vgd;struct lvmcache_info *info; -struct label *label =NULL ;const char *vgid =FMT_LVM1_ORPHAN_VG_NAME ;const char *vgname =FMT_LVM1_ORPHAN_VG_NAME ;unsigned exported =0 ; -int r =0 ;munge_pvd (dev, pvd);
@@ -78,9 +76,8 @@ static int _lvm1_read(struct labeller *l, struct device *dev, void *buf, unsigneif (!(info =lvmcache_add (l, (char *)pvd->pv_uuid, dev, vgname, vgid, exported))) - goto_out; - - label =lvmcache_get_label (info); + return_0; + *label =lvmcache_get_label (info);lvmcache_set_device_size (info, ((uint64_t )xlate32 (pvd->pv_size)) <<SECTOR_SHIFT );lvmcache_set_ext_version (info,0 );
@@ -89,13 +86,7 @@ static int _lvm1_read(struct labeller *l, struct device *dev, void *buf, unsignelvmcache_del_bas (info);lvmcache_make_valid (info); - r =1 ; - -out: -if (read_label_callback_fn) -read_label_callback_fn (!r,0 , read_label_callback_context, label); - -return r; +return 1 ; }static int _lvm1_initialise_label (struct labeller *l __attribute__((unused)),struct label *label)
lib/format_pool/disk_rep.c +1 -1
@@ -40,7 +40,7 @@ static int __read_pool_disk(const struct format_type *fmt, struct device *dev, char buf[512] __attribute__((aligned(8)));/* FIXME: Need to check the cache here first */ -if (!dev_read_buf (dev,UINT64_C (0 ),512 ,DEV_IO_POOL , buf)) { +if (!dev_read (dev,UINT64_C (0 ),512 ,DEV_IO_POOL , buf)) {log_very_verbose ("Failed to read PV data from %s" ,dev_name (dev));return 0 ;
lib/format_pool/format_pool.c +1 -1
@@ -103,7 +103,7 @@ static struct volume_group *_pool_vg_read(struct format_instance *fid, struct metadata_area *mda __attribute__((unused)), struct cached_vg_fmtdata **vg_fmtdata __attribute__((unused)), unsigned *use_previous_vg __attribute__((unused)), - int single_device __attribute__((unused)), unsigned ioflags) + int single_device __attribute__((unused))) {struct volume_group *vg;struct user_subpool *usp;
lib/format_pool/pool_label.c +3 -10
@@ -55,19 +55,12 @@ static int _pool_write(struct label *label __attribute__((unused)), void *buf __return 0 ; } -static int _pool_read (struct labeller *l,struct device *dev,void *buf,unsigned ioflags, -lvm_callback_fn_t read_label_callback_fn,void *read_label_callback_context) +static int _pool_read (struct labeller *l,struct device *dev,void *buf, +struct label **label) {struct pool_list pl; -struct label *label; -int r; - r =read_pool_label (&pl, l, dev, buf, &label); - -if (read_label_callback_fn) -read_label_callback_fn (!r,0 , read_label_callback_context, label); - -return r; +return read_pool_label (&pl, l, dev, buf, label); }static int _pool_initialise_label (struct labeller *l __attribute__((unused)),struct label *label)
lib/format_text/archive.c +2 -2
@@ -135,8 +135,8 @@ static struct dm_list *_scan_archive(struct dm_pool *mem,dm_list_init (results); -/* Use versionsort to handle numbers beyond 5 digits */ -if ((count =scandir (dir, &dirent,NULL , versionsort)) <0 ) { +/* Sort fails beyond 5-digit indexes */ +if ((count =scandir (dir, &dirent,NULL , alphasort)) <0 ) {log_error ("Couldn't scan the archive directory (%s)." , dir);return 0 ; }
lib/format_text/archiver.c +1 -1
@@ -320,7 +320,7 @@ struct volume_group *backup_read_vg(struct cmd_context *cmd, } dm_list_iterate_items(mda, &tf->metadata_areas_in_use) { -if (!(vg = mda->ops->vg_read (tf, vg_name, mda,NULL ,NULL ,0 ,0 ))) +if (!(vg = mda->ops->vg_read (tf, vg_name, mda,NULL ,NULL ,0 ))) stack;break ; }
lib/format_text/export.c +7 -14
@@ -23,7 +23,6 @@#include "lvm-version.h" #include "toolcontext.h" #include "config-util.h" -#include "layout.h" #include <stdarg.h> #include <time.h>
@@ -124,12 +123,11 @@ static int _extend_buffer(struct formatter *f)log_debug_metadata ("Doubling metadata output buffer to " FMTu32, f->data.buf.size *2 ); -if (!(newbuf =dm_malloc_aligned (f->data.buf.size *2 ,0 ))) - return_0; - -memcpy (newbuf, f->data.buf.start, f->data.buf.size); -free (f->data.buf.start); - +if (!(newbuf =dm_realloc (f->data.buf.start, + f->data.buf.size *2 ))) { +log_error ("Buffer reallocation failed." ); +return 0 ; + } f->data.buf.start = newbuf; f->data.buf.size *=2 ;
@@ -1066,7 +1064,7 @@ size_t text_vg_export_raw(struct volume_group *vg, const char *desc, char **buf) return_0; f->data.buf.size =65536 ;/* Initial metadata limit */ -if (!(f->data.buf.start =dm_malloc_aligned (f->data.buf.size,0 ))) { +if (!(f->data.buf.start =dm_malloc (f->data.buf.size))) {log_error ("text_export buffer allocation failed" ); goto out; }
@@ -1081,12 +1079,7 @@ size_t text_vg_export_raw(struct volume_group *vg, const char *desc, char **buf) goto_out; } - f->data.buf.used +=1 ;/* Terminating NUL */ - -/* Zero fill up to next alignment boundary */ -memset (f->data.buf.start + f->data.buf.used,0 ,MDA_ALIGNMENT - f->data.buf.used %MDA_ALIGNMENT ); - - r = f->data.buf.used; + r = f->data.buf.used +1 ; *buf = f->data.buf.start; out:
lib/format_text/format-text.c +146 -395
865 lines not on this page · raw message
lib/format_text/import-export.h +3 -5
@@ -80,7 +80,7 @@ struct volume_group *text_vg_import_fd(struct format_instance *fid, off_t offset, uint32_t size, off_t offset2, uint32_t size2, checksum_fn_t checksum_fn, - uint32_t checksum, unsigned ioflags, + uint32_t checksum, time_t *when, char **desc); int text_vgsummary_import(const struct format_type *fmt,
@@ -88,9 +88,7 @@ int text_vgsummary_import(const struct format_type *fmt, off_t offset, uint32_t size, off_t offset2, uint32_t size2, checksum_fn_t checksum_fn, - int checksum_only, unsigned ioflags, - struct lvmcache_vgsummary *vgsummary, - lvm_callback_fn_t process_vgsummary_fn, - void *process_vgsummary_context); + int checksum_only, + struct lvmcache_vgsummary *vgsummary);#endif
lib/format_text/import.c +74 -161
179 lines not on this page · raw message
lib/format_text/text_label.c +46 -151
197 lines not on this page · raw message
lib/label/label.c +50 -123
173 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Part of the diff is not shown here. View the raw message.