Skip to contentSkip to conversation

device-mapper dmsetup/dmsetup.c lib/libdevmapp ...

PATCH [email protected] 1 participant 1 message Nov 30, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/dm
Module name: device-mapper
Changes by: [email protected] 2007-11-30 14:59:58

Modified files:

	dmsetup        : dmsetup.c 
	lib            : libdevmapper.h libdm-common.c libdm-common.h 
	lib/ioctl      : libdm-iface.c 

Log message:
read_ahead node ops

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/device-mapper/dmsetup/dmsetup.c.diff?cvsroot=dm&r1=1.98&r2=1.99
http://sourceware.org/cgi-bin/cvsweb.cgi/device-mapper/lib/libdevmapper.h.diff?cvsroot=dm&r1=1.77&r2=1.78
http://sourceware.org/cgi-bin/cvsweb.cgi/device-mapper/lib/libdm-common.c.diff?cvsroot=dm&r1=1.48&r2=1.49
http://sourceware.org/cgi-bin/cvsweb.cgi/device-mapper/lib/libdm-common.h.diff?cvsroot=dm&r1=1.4&r2=1.5
http://sourceware.org/cgi-bin/cvsweb.cgi/device-mapper/lib/ioctl/libdm-iface.c.diff?cvsroot=dm&r1=1.47&r2=1.48

dmsetup/dmsetup.c +8 -3
@@ -326,6 +326,7 @@
 static void _display_info_long(struct dm_task *dmt, struct dm_info *info)
 {
 	const char *uuid;
+	uint32_t read_ahead;
 
 	if (!info->exists) {
 		printf("Device does not exist.\n");
@@ -338,7 +339,8 @@
 	       info->suspended ? "SUSPENDED" : "ACTIVE",
 	       info->read_only ? " (READ-ONLY)" : "");
 
-	printf("Read Ahead:       %d\n", (int) dm_task_get_read_ahead(dmt));
+	if (dm_task_get_read_ahead(dmt, &read_ahead))
+		printf("Read Ahead:       %" PRIu32 "\n", read_ahead);
 
 	if (!info->live_table && !info->inactive_table)
 		printf("Tables present:    None\n");
@@ -1613,9 +1615,12 @@
 			       struct dm_report_field *field, const void *data,
 			       void *private __attribute((unused)))
 {
-	int32_t value = (int32_t) dm_task_get_read_ahead((const struct dm_task *) data);
+	uint32_t value;
 
-	return dm_report_field_int32(rh, field, &value);
+	if (!dm_task_get_read_ahead((const struct dm_task *) data, &value))
+		value = 0;
+
+	return dm_report_field_uint32(rh, field, &value);
 }
 
 static int _dm_info_status_disp(struct dm_report *rh,
lib/libdevmapper.h +2 -1
@@ -167,7 +167,8 @@
 
 int dm_task_set_read_ahead(struct dm_task *dmt, uint32_t read_ahead,
 			   uint32_t read_ahead_flags);
-uint32_t dm_task_get_read_ahead(const struct dm_task *dmt);
+uint32_t dm_task_get_read_ahead(const struct dm_task *dmt,
+				uint32_t *read_ahead);
 
 /*
  * Use these to prepare for a create or reload.
lib/libdm-common.c +67 -7

131 lines not on this page · raw message

lib/libdm-common.h +3 -0
@@ -26,6 +26,9 @@
 		 uid_t uid, gid_t gid, mode_t mode);
 int rm_dev_node(const char *dev_name);
 int rename_dev_node(const char *old_name, const char *new_name);
+int get_dev_node_read_ahead(const char *dev_name, uint32_t *read_ahead);
+int set_dev_node_read_ahead(const char *dev_name, uint32_t read_ahead,
+			    uint32_t read_ahead_flags);
 void update_devs(void);
 
 #endif
lib/ioctl/libdm-iface.c +7 -5
@@ -920,12 +920,9 @@
 	return 1;
 }
 
-uint32_t dm_task_get_read_ahead(const struct dm_task *dmt)
+uint32_t dm_task_get_read_ahead(const struct dm_task *dmt, uint32_t *read_ahead)
 {              
-	uint32_t read_ahead = 0; //FIXME default?  How cope with failure below?
-	// FIXME (void) dm_blockdev_get_read_ahead(dmt->dev_name, &read_ahead);
-
-	return read_ahead;
+	return get_dev_node_read_ahead(dmt->dev_name, read_ahead);
 }
 
 const char *dm_task_get_name(const struct dm_task *dmt)
@@ -1685,6 +1682,11 @@
 			rename_dev_node(dmt->dev_name, dmt->newname);
 		break;
 
+	case DM_DEVICE_RESUME:
+		set_dev_node_read_ahead(dmi->name, dmt->read_ahead,
+					dmt->read_ahead_flags);
+		break;
+	
 	case DM_DEVICE_MKNODES:
 		if (dmi->flags & DM_EXISTS_FLAG)
 			add_dev_node(dmi->name, MAJOR(dmi->dev),