master - dev_cache: drop open_list
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=bbb8040456a07a0c9076d45a8eee5e5f7fcde0ec Commit: bbb8040456a07a0c9076d45a8eee5e5f7fcde0ec Parent: 43620138726da124f5eb58c9347cba8b582271ed Author: David Teigland <[email protected]> AuthorDate: Fri May 11 11:59:44 2018 -0500 Committer: David Teigland <[email protected]> CommitterDate: Fri May 11 12:47:56 2018 -0500
dev_cache: drop open_list
devices are now held open only in bcache,
so drop the dev_cache list of open devices
which is unused.
--- lib/cache/lvmcache.c | 1 - lib/device/dev-cache.c | 1 - lib/device/dev-io.c | 16 ---------------- lib/device/device.h | 2 -- lib/label/label.c | 4 ---- lib/metadata/metadata.c | 2 -- lib/misc/lvm-exec.c | 1 - tools/polldaemon.c | 8 -------- tools/toollib.c | 1 - 9 files changed, 0 insertions(+), 36 deletions(-)
lib/cache/lvmcache.c +0 -1
@@ -643,7 +643,6 @@ void lvmcache_unlock_vgname(const char *vgname)/* FIXME Do this per-VG */ if (strcmp (vgname,VG_GLOBAL ) && !--_vgs_locked) { -dev_close_all ();dev_size_seqno_inc ();/* invalidate all cached dev sizes */ } }
lib/device/dev-cache.c +0 -1
@@ -73,7 +73,6 @@ static void _dev_init(struct device *dev, int max_error_count) dev->ext.src =DEV_EXT_NONE ;dm_list_init (&dev->aliases); -dm_list_init (&dev->open_list); }void dev_destroy_file (struct device *dev)
lib/device/dev-io.c +0 -16
@@ -53,7 +53,6 @@# endif #endif -static DM_LIST_INIT (_open_devices);static unsigned _dev_size_seqno =1 ;static const char *_reasons[] = {
@@ -597,8 +596,6 @@ int dev_open_flags(struct device *dev, int flags, int direct, int quiet)if ((flags &O_CREAT ) && !(flags &O_TRUNC )) dev->end =lseek (dev->fd, (off_t )0 ,SEEK_END ); -dm_list_add (&_open_devices, &dev->open_list); - log_debug_devs("Opened %s %s%s%s", dev_name(dev), dev->flags & DEV_OPENED_RW ? "RW" : "RO", dev->flags & DEV_OPENED_EXCL ? " O_EXCL" : "",
@@ -650,7 +647,6 @@ static void _close(struct device *dev) dev->fd =-1 ; dev->phys_block_size =-1 ; dev->block_size =-1 ; -dm_list_del (&dev->open_list);log_debug_devs ("Closed %s" ,dev_name (dev));
@@ -696,18 +692,6 @@ int dev_close_immediate(struct device *dev)return _dev_close (dev,1 ); } -void dev_close_all (void ) -{ -struct dm_list *doh, *doht; -struct device *dev; - - dm_list_iterate_safe(doh, doht, &_open_devices) { - dev = dm_list_struct_base(doh, struct device, open_list); -if (dev->open_count <1 ) -_close (dev); - } -} -static inline int _dev_is_valid (struct device *dev) { return (dev->max_error_count == NO_DEV_ERROR_COUNT_LIMIT ||
lib/device/device.h +0 -2
@@ -74,7 +74,6 @@ struct device {unsigned size_seqno;uint64_t size;uint64_t end; -struct dm_list open_list;struct dev_ext ext;const char *vgid;/* if device is an LV */
@@ -144,7 +143,6 @@ int dev_open_readonly_buffered(struct device *dev);int dev_open_readonly_quiet (struct device *dev);int dev_close (struct device *dev);int dev_close_immediate (struct device *dev); -void dev_close_all (void );int dev_test_excl (struct device *dev);int dev_fd (struct device *dev);
lib/label/label.c +0 -4
@@ -975,8 +975,6 @@ int label_scan_open(struct device *dev)bool dev_read_bytes (struct device *dev,uint64_t start,size_t len,void *data) { -int ret; -if (!scan_bcache) {/* Should not happen */ log_error ("dev_read bcache not set up %s" ,dev_name (dev));
@@ -1003,8 +1001,6 @@ bool dev_read_bytes(struct device *dev, uint64_t start, size_t len, void *data)bool dev_write_bytes (struct device *dev,uint64_t start,size_t len,void *data) { -int ret; -if (test_mode ())return true;
lib/metadata/metadata.c +0 -2
@@ -5192,8 +5192,6 @@ static struct volume_group *_recover_vg(struct cmd_context *cmd,unlock_vg (cmd,NULL , vg_name); -dev_close_all (); -if (!lock_vol (cmd, vg_name,LCK_VG_WRITE ,NULL )) return_NULL;
lib/misc/lvm-exec.c +0 -1
@@ -78,7 +78,6 @@ int exec_cmd(struct cmd_context *cmd, const char *const argv[],if (!pid) {/* Child */ reset_locking (); -dev_close_all ();/* FIXME Fix effect of reset_locking on cache then include this */ /* destroy_toolcontext(cmd); */ /* FIXME Use execve directly */
tools/polldaemon.c +0 -8
@@ -134,7 +134,6 @@ static void _sleep_and_rescan_devices(struct cmd_context *cmd, struct daemon_par*/ lvmcache_destroy (cmd,1 ,0 );label_scan_destroy (cmd); -dev_close_all ();_nanosleep (parms->interval,1 );lvmcache_label_scan (cmd); }
@@ -530,9 +529,6 @@ static void _lvmpolld_poll_for_all_vgs(struct cmd_context *cmd,_report_progress (cmd, idl->id, lpdp.parms); } -if (lpdp.parms->interval) -dev_close_all (); -_nanosleep (lpdp.parms->interval,0 ); }
@@ -559,9 +555,6 @@ static int _lvmpoll_daemon(struct cmd_context *cmd, struct poll_operation_id *id (!parms->aborting && !(r = _report_progress(cmd, id, parms)))) break; -if (parms->interval) -dev_close_all (); -_nanosleep (parms->interval,0 ); } }
@@ -620,7 +613,6 @@ static int _poll_daemon(struct cmd_context *cmd, struct poll_operation_id *id,/* clear lvmcache/bcache/fds from the parent */ lvmcache_destroy (cmd,1 ,0 );label_scan_destroy (cmd); -dev_close_all ();if (id) {if (!wait_for_single_lv (cmd, id, parms)) {
tools/toollib.c +0 -1
@@ -115,7 +115,6 @@ int become_daemon(struct cmd_context *cmd, int skip_lvm)/* FIXME Clean up properly here */ _exit (ECMD_FAILED ); } -dev_close_all ();return 1 ; }