162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 262306a36Sopenharmony_ci#ifndef FS_CEPH_IOCTL_H 362306a36Sopenharmony_ci#define FS_CEPH_IOCTL_H 462306a36Sopenharmony_ci 562306a36Sopenharmony_ci#include <linux/ioctl.h> 662306a36Sopenharmony_ci#include <linux/types.h> 762306a36Sopenharmony_ci 862306a36Sopenharmony_ci#define CEPH_IOCTL_MAGIC 0x97 962306a36Sopenharmony_ci 1062306a36Sopenharmony_ci/* 1162306a36Sopenharmony_ci * CEPH_IOC_GET_LAYOUT - get file layout or dir layout policy 1262306a36Sopenharmony_ci * CEPH_IOC_SET_LAYOUT - set file layout 1362306a36Sopenharmony_ci * CEPH_IOC_SET_LAYOUT_POLICY - set dir layout policy 1462306a36Sopenharmony_ci * 1562306a36Sopenharmony_ci * The file layout specifies how file data is striped over objects in 1662306a36Sopenharmony_ci * the distributed object store, which object pool they belong to (if 1762306a36Sopenharmony_ci * it differs from the default), and an optional 'preferred osd' to 1862306a36Sopenharmony_ci * store them on. 1962306a36Sopenharmony_ci * 2062306a36Sopenharmony_ci * Files get a new layout based on the policy set on the containing 2162306a36Sopenharmony_ci * directory or one of its ancestors. The GET_LAYOUT ioctl will let 2262306a36Sopenharmony_ci * you examine the layout for a file or the policy on a directory. 2362306a36Sopenharmony_ci * 2462306a36Sopenharmony_ci * SET_LAYOUT will let you set a layout on a newly created file. This 2562306a36Sopenharmony_ci * only works immediately after the file is created and before any 2662306a36Sopenharmony_ci * data is written to it. 2762306a36Sopenharmony_ci * 2862306a36Sopenharmony_ci * SET_LAYOUT_POLICY will let you set a layout policy (default layout) 2962306a36Sopenharmony_ci * on a directory that will apply to any new files created in that 3062306a36Sopenharmony_ci * directory (or any child directory that doesn't specify a layout of 3162306a36Sopenharmony_ci * its own). 3262306a36Sopenharmony_ci */ 3362306a36Sopenharmony_ci 3462306a36Sopenharmony_ci/* use u64 to align sanely on all archs */ 3562306a36Sopenharmony_cistruct ceph_ioctl_layout { 3662306a36Sopenharmony_ci __u64 stripe_unit, stripe_count, object_size; 3762306a36Sopenharmony_ci __u64 data_pool; 3862306a36Sopenharmony_ci 3962306a36Sopenharmony_ci /* obsolete. new values ignored, always return -1 */ 4062306a36Sopenharmony_ci __s64 preferred_osd; 4162306a36Sopenharmony_ci}; 4262306a36Sopenharmony_ci 4362306a36Sopenharmony_ci#define CEPH_IOC_GET_LAYOUT _IOR(CEPH_IOCTL_MAGIC, 1, \ 4462306a36Sopenharmony_ci struct ceph_ioctl_layout) 4562306a36Sopenharmony_ci#define CEPH_IOC_SET_LAYOUT _IOW(CEPH_IOCTL_MAGIC, 2, \ 4662306a36Sopenharmony_ci struct ceph_ioctl_layout) 4762306a36Sopenharmony_ci#define CEPH_IOC_SET_LAYOUT_POLICY _IOW(CEPH_IOCTL_MAGIC, 5, \ 4862306a36Sopenharmony_ci struct ceph_ioctl_layout) 4962306a36Sopenharmony_ci 5062306a36Sopenharmony_ci/* 5162306a36Sopenharmony_ci * CEPH_IOC_GET_DATALOC - get location of file data in the cluster 5262306a36Sopenharmony_ci * 5362306a36Sopenharmony_ci * Extract identity, address of the OSD and object storing a given 5462306a36Sopenharmony_ci * file offset. 5562306a36Sopenharmony_ci */ 5662306a36Sopenharmony_cistruct ceph_ioctl_dataloc { 5762306a36Sopenharmony_ci __u64 file_offset; /* in+out: file offset */ 5862306a36Sopenharmony_ci __u64 object_offset; /* out: offset in object */ 5962306a36Sopenharmony_ci __u64 object_no; /* out: object # */ 6062306a36Sopenharmony_ci __u64 object_size; /* out: object size */ 6162306a36Sopenharmony_ci char object_name[64]; /* out: object name */ 6262306a36Sopenharmony_ci __u64 block_offset; /* out: offset in block */ 6362306a36Sopenharmony_ci __u64 block_size; /* out: block length */ 6462306a36Sopenharmony_ci __s64 osd; /* out: osd # */ 6562306a36Sopenharmony_ci struct sockaddr_storage osd_addr; /* out: osd address */ 6662306a36Sopenharmony_ci}; 6762306a36Sopenharmony_ci 6862306a36Sopenharmony_ci#define CEPH_IOC_GET_DATALOC _IOWR(CEPH_IOCTL_MAGIC, 3, \ 6962306a36Sopenharmony_ci struct ceph_ioctl_dataloc) 7062306a36Sopenharmony_ci 7162306a36Sopenharmony_ci/* 7262306a36Sopenharmony_ci * CEPH_IOC_LAZYIO - relax consistency 7362306a36Sopenharmony_ci * 7462306a36Sopenharmony_ci * Normally Ceph switches to synchronous IO when multiple clients have 7562306a36Sopenharmony_ci * the file open (and or more for write). Reads and writes bypass the 7662306a36Sopenharmony_ci * page cache and go directly to the OSD. Setting this flag on a file 7762306a36Sopenharmony_ci * descriptor will allow buffered IO for this file in cases where the 7862306a36Sopenharmony_ci * application knows it won't interfere with other nodes (or doesn't 7962306a36Sopenharmony_ci * care). 8062306a36Sopenharmony_ci */ 8162306a36Sopenharmony_ci#define CEPH_IOC_LAZYIO _IO(CEPH_IOCTL_MAGIC, 4) 8262306a36Sopenharmony_ci 8362306a36Sopenharmony_ci/* 8462306a36Sopenharmony_ci * CEPH_IOC_SYNCIO - force synchronous IO 8562306a36Sopenharmony_ci * 8662306a36Sopenharmony_ci * This ioctl sets a file flag that forces the synchronous IO that 8762306a36Sopenharmony_ci * bypasses the page cache, even if it is not necessary. This is 8862306a36Sopenharmony_ci * essentially the opposite behavior of IOC_LAZYIO. This forces the 8962306a36Sopenharmony_ci * same read/write path as a file opened by multiple clients when one 9062306a36Sopenharmony_ci * or more of those clients is opened for write. 9162306a36Sopenharmony_ci * 9262306a36Sopenharmony_ci * Note that this type of sync IO takes a different path than a file 9362306a36Sopenharmony_ci * opened with O_SYNC/D_SYNC (writes hit the page cache and are 9462306a36Sopenharmony_ci * immediately flushed on page boundaries). It is very similar to 9562306a36Sopenharmony_ci * O_DIRECT (writes bypass the page cache) excep that O_DIRECT writes 9662306a36Sopenharmony_ci * are not copied (user page must remain stable) and O_DIRECT writes 9762306a36Sopenharmony_ci * have alignment restrictions (on the buffer and file offset). 9862306a36Sopenharmony_ci */ 9962306a36Sopenharmony_ci#define CEPH_IOC_SYNCIO _IO(CEPH_IOCTL_MAGIC, 5) 10062306a36Sopenharmony_ci 10162306a36Sopenharmony_ci#endif 102