From 0b7d16bc0981a65d07ddbf7c458400c9a33f0e64 Mon Sep 17 00:00:00 2001 From: Alasdair Kergon Date: Mon, 3 Dec 2007 22:48:36 +0000 Subject: [PATCH] fixes --- libdm/ioctl/libdm-iface.c | 7 +++++-- libdm/libdm-common.c | 6 +++--- libdm/libdm-deptree.c | 7 +++++++ tools/dmsetup.c | 2 +- 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/libdm/ioctl/libdm-iface.c b/libdm/ioctl/libdm-iface.c index f44839a1c..663abecd5 100644 --- a/libdm/ioctl/libdm-iface.c +++ b/libdm/ioctl/libdm-iface.c @@ -1281,7 +1281,9 @@ static struct dm_ioctl *_flatten(struct dm_task *dmt, unsigned repeat_count) dmt->major, dmt->minor, dmi->name); } - if (dmt->dev_name) + /* FIXME Until resume ioctl supplies name, use dev_name for readahead */ + if (dmt->dev_name && (dmt->type != DM_DEVICE_RESUME || dmt->minor < 0 || + dmt->major < 0)) strncpy(dmi->name, dmt->dev_name, sizeof(dmi->name)); if (dmt->uuid) @@ -1683,7 +1685,8 @@ repeat_ioctl: break; case DM_DEVICE_RESUME: - set_dev_node_read_ahead(dmi->name, dmt->read_ahead, + /* FIXME Kernel needs to fill in dmi->name */ + set_dev_node_read_ahead(dmt->dev_name, dmt->read_ahead, dmt->read_ahead_flags); break; diff --git a/libdm/libdm-common.c b/libdm/libdm-common.c index cc80e1813..72631e2c6 100644 --- a/libdm/libdm-common.c +++ b/libdm/libdm-common.c @@ -386,13 +386,13 @@ int get_dev_node_read_ahead(const char *dev_name, uint32_t *read_ahead) *read_ahead = 0; - if (!ioctl(fd, BLKRAGET, read_ahead)) { + if (ioctl(fd, BLKRAGET, read_ahead)) { log_sys_error("BLKRAGET", dev_name); r = 0; } else log_debug("%s: read ahead is %" PRIu32, dev_name, *read_ahead); - if (!close(fd)) + if (close(fd)) stack; return r; @@ -413,7 +413,7 @@ static int _set_read_ahead(const char *dev_name, uint32_t read_ahead) r = 0; } - if (!close(fd)) + if (close(fd)) stack; return r; diff --git a/libdm/libdm-deptree.c b/libdm/libdm-deptree.c index 19c2037ea..14e2b4ad8 100644 --- a/libdm/libdm-deptree.c +++ b/libdm/libdm-deptree.c @@ -901,6 +901,13 @@ static int _resume_node(const char *name, uint32_t major, uint32_t minor, return 0; } + /* FIXME Kernel should fill in name on return instead */ + if (!dm_task_set_name(dmt, name)) { + log_error("Failed to set readahead device name for %s", name); + dm_task_destroy(dmt); + return 0; + } + if (!dm_task_set_major(dmt, major) || !dm_task_set_minor(dmt, minor)) { log_error("Failed to set device number for %s resumption.", name); dm_task_destroy(dmt); diff --git a/tools/dmsetup.c b/tools/dmsetup.c index 97099c001..c2b5622ba 100644 --- a/tools/dmsetup.c +++ b/tools/dmsetup.c @@ -340,7 +340,7 @@ static void _display_info_long(struct dm_task *dmt, struct dm_info *info) info->read_only ? " (READ-ONLY)" : ""); if (dm_task_get_read_ahead(dmt, &read_ahead)) - printf("Read Ahead: %" PRIu32 "\n", read_ahead); + printf("Read Ahead: %" PRIu32 "\n", read_ahead); if (!info->live_table && !info->inactive_table) printf("Tables present: None\n");