Pfcache/API

From OpenVZ Virtuozzo Containers Wiki
Revision as of 11:24, 21 February 2012 by Kir (talk | contribs) (moved Pfcache/internals to Pfcache/API)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Kernel pfcache API is described in linux/pfcache.h

Filesystem attributes[edit]

xattr "trusted.pfcache" (PFCACHE_XATTR_NAME)

for directories: "auto" -- checksum files at create, inherited from parent on mkdir.

for regular files: SHA-1 checksum, 40 (PFCACHE_CSUM_SIZE * 2) chars length hex string.

ioctls[edit]

FS_IOC_PFCACHE_OPEN[edit]

ioctl(fd, FS_IOC_PFCACHE_OPEN)

Try to reopen pfcache peer for this inode

Exit codes
-EPERM no cap-sys-admin
-ENODATA no checksum
-ENODEV no prcache on fs
-ENOENT cache peer not found
-EBUSY already opened
-EINVAL cache peer does not match or not regular file
-EMLINK cache peer has itself cache peer, or symlinks mess
-ETXTBSY cache peer opened for write
... plus all the open(2) error codes
0 success!

FS_IOC_PFCACHE_CLOSE[edit]

ioctl(fd, FS_IOC_PFCACHE_CLOSE)

Close pfcache peer for this inode inode

Exit codes
-EPERM no cap-sys-admin
-ENOENT not opened
0 success

FS_IOC_PFCACHE_DUMP[edit]

ioctl(fd, FS_IOC_PFCACHE_DUMP, struct pfcache_dump_request *)

Dump in-memory inodes for this fs, see linux/pfcache.h for description.

Exit codes
-EPERM no cap-sys-admin
-EINVAL -
-EINTR -
>=0 Number of dumped inodes