mirror of
https://github.com/SCST-project/scst.git
synced 2026-05-17 10:41:26 +00:00
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 <bart.vanassche@sandisk.com> git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5986 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user