]> sourceware.org Git - lvm2.git/commitdiff
device_mapper: reduce min_size for flatten
authorZdenek Kabelac <zkabelac@redhat.com>
Sat, 27 Feb 2021 20:22:41 +0000 (21:22 +0100)
committerZdenek Kabelac <zkabelac@redhat.com>
Tue, 2 Mar 2021 21:57:35 +0000 (22:57 +0100)
For most ioctl() we do not need to pass so big buffers
and we can reduce amount of zeroed memory blocks.

device_mapper/ioctl/libdm-iface.c

index 116fa3dc152f2c7cfdc580ce9a91e67a5facb9e0..906d84b4e18798b9e7b8ec73c6e5a2cfa935f0e6 100644 (file)
@@ -1118,7 +1118,7 @@ static int _add_params(int type)
 
 static struct dm_ioctl *_flatten(struct dm_task *dmt, unsigned repeat_count)
 {
-       const size_t min_size = 16 * 1024;
+       size_t min_size;
        const int (*version)[3];
 
        struct dm_ioctl *dmi;
@@ -1137,6 +1137,18 @@ static struct dm_ioctl *_flatten(struct dm_task *dmt, unsigned repeat_count)
        else if (dmt->head)
                log_debug_activation(INTERNAL_ERROR "dm '%s' ioctl should not define parameters.",
                                     _cmd_data_v4[dmt->type].name);
+       switch (dmt->type) {
+       case DM_DEVICE_CREATE:
+       case DM_DEVICE_DEPS:
+       case DM_DEVICE_INFO:
+       case DM_DEVICE_LIST:
+       case DM_DEVICE_STATUS:
+       case DM_DEVICE_TABLE:
+       case DM_DEVICE_TARGET_MSG:
+               min_size = 16 * 1024;
+       default:
+               min_size = 2 * 1024;
+       }
 
        if (count && (dmt->sector || dmt->message)) {
                log_error("targets and message are incompatible");
This page took 0.040839 seconds and 5 git commands to generate.