Download Lustre 1.8 Operations Manual

Transcript
#define LOV_EA_SIZE(lum, num) (sizeof(*lum) + num * sizeof(*lum->lmm_objects))
#define LOV_EA_MAX(lum) LOV_EA_SIZE(lum, MAX_OSTS)
/*
This program provides crude examples of using the liblustre API functions
*/
/* Change these definitions to suit */
#define
#define
#define
#define
#define
#define
TESTDIR "/tmp"
/* Results directory */
TESTFILE "lustre_dummy"
/* Name for the file we create/destroy */
FILESIZE 262144
/* Size of the file in words */
DUMWORD "DEADBEEF"
/* Dummy word used to fill files */
MY_STRIPE_WIDTH 2
/* Set this to the number of OST required */
MY_LUSTRE_DIR "/mnt/lustre/ftest"
int close_file(int fd)
{
if (close(fd) < 0) {
fprintf(stderr, "File close failed: %d (%s)\n", errno,
strerror(errno));
return -1;
}
return 0;
}
int write_file(int fd)
{
char *stng =
int cnt = 0;
DUMWORD;
for( cnt = 0; cnt < FILESIZE; cnt++) {
write(fd, stng, sizeof(stng));
}
return 0;
}
/* Open a file, set a specific stripe count, size and starting OST
Adjust the parameters to suit */
int open_stripe_file()
{
char *tfile = TESTFILE;
int stripe_size = 65536;
/* System default is 4M */
int stripe_offset = -1;
/* Start at default */
int stripe_count = MY_STRIPE_WIDTH;
/*Single stripe for this
demo*/
int stripe_pattern = 0;
/* only RAID 0 at this time
*/
int rc, fd;
/*
*/
rc = llapi_file_create(tfile,
stripe_size,stripe_offset,stripe_count,stripe_pattern);
Chapter 24
Striping and I/O Options 24-23