 |




|
The Linux FCP driver uses the default ESS subsystem operating
mode Normal Cache Replacement. The mode cannot be changed
for FCP/SCSI disks. This mode enables the ESS to switch between the
standard algorithms depending on the actual I/O pattern. This is
the preferred setting, also for DASD ECKD disks.
The subsystem operating mode can be set for every single DASD
individually and lasts until the next reboot of the Linux system.
After a reboot the operating mode reverts to the default. If you
want to set the mode permanently for a specific DASD, include the
mode switch in a Linux startup script (e.g. by adding the commands
to the appropriate runlevel scripts in '/etc/init.d/rc3.d/').
- Novell/SUSE SLES9
You can use the new Linux command tunedasd to switch between
the subsystem operating modes.
# tunedasd -g /dev/dasdc
normal (2 cyl)
# tunedasd -c sequential -n 2 /dev/dasdc
Setting cache mode for device </dev/dasdc>...
Done.
# tunedasd -g /dev/dasdc
sequential (2 cyl)
- Novell/SUSE SLES8
-
The DASD API (ioctl interface) can be used to switch between the subsystem
operating modes. You can write your own tool with limited C programming
language knowledge.
int ioctl (int fd, int command , xxx)
fd – descriptor of an open file
command – action requested
xxx – pointer to structure which is specific to the request
|
/* *
* *
* (C) Copyright IBM Corp. 2003 *
* *
* *
* */
#include <sys/types.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#define DASD_NORMAL_CACHE 0x0
#define DASD_BYPASS_CACHE 0x1
#define DASD_INHIBIT_LOAD 0x2
#define DASD_SEQ_ACCESS 0x3
#define DASD_SEQ_PRESTAGE 0x4
#define DASD_REC_ACCESS 0x5
/*
struct attrib_data_t
Represents the operation (cache) bits for the device.
Used to influence caching of the DASD.
*/
typedef struct attrib_data_t {
unsigned char operation:3; /* cache operation mode */
unsigned char reserved:5; /* reserved */
unsigned short nr_cyl; /* no of cyl. for read ahead */
unsigned char reserved2[29]; /* for future use */
} __attribute__ ((packed)) attrib_data_t;
/* DASD ioctl identification */
#define DASD_IOCTL_LETTER 'D'
/* set Attributes (cache operations) */
#define BIODASDSATTR _IOW (DASD_IOCTL_LETTER,2,attrib_data_t)
/*
Set the caching algorithm used for the channel programs of this device.
'cache' is the caching mode (see ESS docu for more info) and 'no_cyl'
the number of cylinders to be cached.
*/
int main (int argc, char* argv[])
{
int fd;
attrib_data_t attrib_data;
/* for example set normal caching mode and number of read ahead */
/*cylinders (default 2; if nothing specified,only for seq. modes)*/
attrib_data.operation = DASD_NORMAL_CACHE;
/* attrib_data.nr_cyl = 2; -- only for DASD_SEQ_ACCESS */
/* and DASD_SEQ_PRESTAGE */
/* Open device file */
fd = open ("/dev/dasdc", O_RDWR);
if (fd == -1) {
; /* error handling */
}
/* Set the given caching attributes */
if (ioctl (fd, BIODASDSATTR, &attrib_data))
{
; /* error handling */
}
close (fd);
return 0;
}
|
|
 |
|
 |