From a3d1d4f809b611a38822058a44c841fa36aecbbd Mon Sep 17 00:00:00 2001 From: Vladislav Bolkhovitin Date: Thu, 22 Jan 2015 05:09:17 +0000 Subject: [PATCH] scst_vdisk: Micro-optimize vdisk_caching_pg This patch does not change any behavior but micro-optimizes vdisk_caching_pg(). Declaring the array caching_pg[] const reduces 11 bytes from the assembler code of this function. Signed-off-by: Bart Van Assche git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5986 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/src/dev_handlers/scst_vdisk.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/scst/src/dev_handlers/scst_vdisk.c b/scst/src/dev_handlers/scst_vdisk.c index fab1aab7e..9e51b95e8 100644 --- a/scst/src/dev_handlers/scst_vdisk.c +++ b/scst/src/dev_handlers/scst_vdisk.c @@ -3847,15 +3847,19 @@ static int vdisk_format_pg(unsigned char *p, int pcontrol, static int vdisk_caching_pg(unsigned char *p, int pcontrol, struct scst_vdisk_dev *virt_dev) -{ /* Caching page for mode_sense */ - unsigned char caching_pg[] = {0x8, 0x12, 0x0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0x80, 0x14, 0, 0, 0, 0, 0, 0}; - - if (!virt_dev->nv_cache && vdev_saved_mode_pages_enabled) - caching_pg[0] |= 0x80; +{ + /* Caching page for mode_sense */ + static const unsigned char caching_pg[] = { + 0x8, 0x12, 0x0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0x80, 0x14, 0, 0, + 0, 0, 0, 0 + }; memcpy(p, caching_pg, sizeof(caching_pg)); + if (!virt_dev->nv_cache && vdev_saved_mode_pages_enabled) + p[0] |= 0x80; + switch (pcontrol) { case 0: /* current */ p[2] |= (virt_dev->wt_flag || virt_dev->nv_cache) ? 0 : WCE;