Please enter search query.
Search <book_title>...
Veritas™ File System Programmer's Reference Guide - Solaris
Last Published:
2018-08-24
Product(s):
InfoScale & Storage Foundation (7.2)
Platform: Solaris
- Veritas File System software developer's kit
- File Change Log
- About the File Change Log file
- Record types
- File Change Log tunables
- Application programming interface for File Change Log
- API functions
- File Change Log record
- Copying File Change Log records
- Veritas File System and File Change Log upgrade and downgrade
- Reverse path name lookup
- Multi-volume support
- Named data streams
- Veritas File System I/O
- Caching advisories
- Extents
- Thin Reclamation
Defining and assigning allocation policies
The following pseudocode provides an example of using the allocation policy APIs to define and assign allocation policies.
To define and assign an allocation policy to reallocate an existing file's data blocks to a specific volume
To reallocate an existing file's data blocks to a specific volume (vol-03), create code similar to the following:
/* Create a data policy for moving file's data */ strcpy((char *) ap.ap_name, "Data_Mover_Policy"); ap.ap_flags = FSAP_CREATE; ap.ap_order = FSAP_ORDER_ASGIVEN; ap.ap_ndevs = 1; strcpy(ap.ap_devs[0], "vol-03"); fd = open("/mnt", O_RDONLY); vxfs_ap_define(fd, &ap, 0); file_fd = open ("/mnt/file_to_move", O_RDONLY); vxfs_ap_assign_file(file_fd, "Data_Mover_Policy", NULL, 0); vxfs_ap_enforce_file(file_fd, "Data_Mover_Policy", NULL);
To create policies that allocate new files under a directory
In this example, the files are under dir1, the metadata is allocated to vol-01, and file data is allocated to vol-02.
To create policies to allocate new files under directory dir1, create code similar to the following:
/* Define 2 policies */ /* Create the RAID5 policy */ strcpy((char *) ap.ap_name, "RAID5_Policy"); ap.ap_flags = FSAP_CREATE | FSAP_INHERIT; ap.ap_order = FSAP_ORDER_ASGIVEN; ap.ap_ndevs = 1; strcpy(ap.ap_devs[0], "vol-02"); fd = open("/mnt", O_RDONLY); dir_fd = open("/mnt/dir1", O_RDONLY); vxfs_ap_define(fd, &ap, 0); /* Create the mirror policy */ strcpy((char *) ap.ap_name, "Mirror_Policy"); ap.ap_flags = FSAP_CREATE | FSAP_INHERIT; ap.ap_order = FSAP_ORDER_ASGIVEN; ap.ap_ndevs = 1; strcpy(ap.ap_devs[0], "vol-01"); vxfs_ap_define(fd, &ap, 0); /* Assign policies to the directory */ vxfs_ap_assign_file(dir_fd, "RAID5_Policy", "Mirror_Policy", 0); /* Create file under directory dir1 */ /* Meta and data blocks for file1 will be allocated on vol-01 and vol-02 respectively. */ file_fd = open("/mnt/dir1/file1"); write(file_fd, buf, 1024);