1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

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.
This commit is contained in:
David Teigland 2018-05-11 11:59:44 -05:00
parent 4362013872
commit bbb8040456
9 changed files with 0 additions and 36 deletions

View File

@ -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 */
}
}

View File

@ -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)

View File

@ -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 ||

View File

@ -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);

View File

@ -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;

View File

@ -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;

View File

@ -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 */

View File

@ -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)) {

View File

@ -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;
}