1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-13 17:18:32 +03:00
This commit is contained in:
Alasdair Kergon 2007-12-03 22:48:36 +00:00
parent fd0af4bd29
commit 0b7d16bc09
4 changed files with 16 additions and 6 deletions

View File

@ -1281,7 +1281,9 @@ static struct dm_ioctl *_flatten(struct dm_task *dmt, unsigned repeat_count)
dmt->major, dmt->minor, dmi->name); 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)); strncpy(dmi->name, dmt->dev_name, sizeof(dmi->name));
if (dmt->uuid) if (dmt->uuid)
@ -1683,7 +1685,8 @@ repeat_ioctl:
break; break;
case DM_DEVICE_RESUME: 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); dmt->read_ahead_flags);
break; break;

View File

@ -386,13 +386,13 @@ int get_dev_node_read_ahead(const char *dev_name, uint32_t *read_ahead)
*read_ahead = 0; *read_ahead = 0;
if (!ioctl(fd, BLKRAGET, read_ahead)) { if (ioctl(fd, BLKRAGET, read_ahead)) {
log_sys_error("BLKRAGET", dev_name); log_sys_error("BLKRAGET", dev_name);
r = 0; r = 0;
} else } else
log_debug("%s: read ahead is %" PRIu32, dev_name, *read_ahead); log_debug("%s: read ahead is %" PRIu32, dev_name, *read_ahead);
if (!close(fd)) if (close(fd))
stack; stack;
return r; return r;
@ -413,7 +413,7 @@ static int _set_read_ahead(const char *dev_name, uint32_t read_ahead)
r = 0; r = 0;
} }
if (!close(fd)) if (close(fd))
stack; stack;
return r; return r;

View File

@ -901,6 +901,13 @@ static int _resume_node(const char *name, uint32_t major, uint32_t minor,
return 0; 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)) { if (!dm_task_set_major(dmt, major) || !dm_task_set_minor(dmt, minor)) {
log_error("Failed to set device number for %s resumption.", name); log_error("Failed to set device number for %s resumption.", name);
dm_task_destroy(dmt); dm_task_destroy(dmt);

View File

@ -340,7 +340,7 @@ static void _display_info_long(struct dm_task *dmt, struct dm_info *info)
info->read_only ? " (READ-ONLY)" : ""); info->read_only ? " (READ-ONLY)" : "");
if (dm_task_get_read_ahead(dmt, &read_ahead)) 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) if (!info->live_table && !info->inactive_table)
printf("Tables present: None\n"); printf("Tables present: None\n");