Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef FS_CEPH_IOCTL_H
0003 #define FS_CEPH_IOCTL_H
0004 
0005 #include <linux/ioctl.h>
0006 #include <linux/types.h>
0007 
0008 #define CEPH_IOCTL_MAGIC 0x97
0009 
0010 /*
0011  * CEPH_IOC_GET_LAYOUT - get file layout or dir layout policy
0012  * CEPH_IOC_SET_LAYOUT - set file layout
0013  * CEPH_IOC_SET_LAYOUT_POLICY - set dir layout policy
0014  *
0015  * The file layout specifies how file data is striped over objects in
0016  * the distributed object store, which object pool they belong to (if
0017  * it differs from the default), and an optional 'preferred osd' to
0018  * store them on.
0019  *
0020  * Files get a new layout based on the policy set on the containing
0021  * directory or one of its ancestors.  The GET_LAYOUT ioctl will let
0022  * you examine the layout for a file or the policy on a directory.
0023  *
0024  * SET_LAYOUT will let you set a layout on a newly created file.  This
0025  * only works immediately after the file is created and before any
0026  * data is written to it.
0027  *
0028  * SET_LAYOUT_POLICY will let you set a layout policy (default layout)
0029  * on a directory that will apply to any new files created in that
0030  * directory (or any child directory that doesn't specify a layout of
0031  * its own).
0032  */
0033 
0034 /* use u64 to align sanely on all archs */
0035 struct ceph_ioctl_layout {
0036     __u64 stripe_unit, stripe_count, object_size;
0037     __u64 data_pool;
0038 
0039     /* obsolete.  new values ignored, always return -1 */
0040     __s64 preferred_osd;
0041 };
0042 
0043 #define CEPH_IOC_GET_LAYOUT _IOR(CEPH_IOCTL_MAGIC, 1,       \
0044                    struct ceph_ioctl_layout)
0045 #define CEPH_IOC_SET_LAYOUT _IOW(CEPH_IOCTL_MAGIC, 2,       \
0046                    struct ceph_ioctl_layout)
0047 #define CEPH_IOC_SET_LAYOUT_POLICY _IOW(CEPH_IOCTL_MAGIC, 5,    \
0048                    struct ceph_ioctl_layout)
0049 
0050 /*
0051  * CEPH_IOC_GET_DATALOC - get location of file data in the cluster
0052  *
0053  * Extract identity, address of the OSD and object storing a given
0054  * file offset.
0055  */
0056 struct ceph_ioctl_dataloc {
0057     __u64 file_offset;           /* in+out: file offset */
0058     __u64 object_offset;         /* out: offset in object */
0059     __u64 object_no;             /* out: object # */
0060     __u64 object_size;           /* out: object size */
0061     char object_name[64];        /* out: object name */
0062     __u64 block_offset;          /* out: offset in block */
0063     __u64 block_size;            /* out: block length */
0064     __s64 osd;                   /* out: osd # */
0065     struct sockaddr_storage osd_addr; /* out: osd address */
0066 };
0067 
0068 #define CEPH_IOC_GET_DATALOC _IOWR(CEPH_IOCTL_MAGIC, 3, \
0069                    struct ceph_ioctl_dataloc)
0070 
0071 /*
0072  * CEPH_IOC_LAZYIO - relax consistency
0073  *
0074  * Normally Ceph switches to synchronous IO when multiple clients have
0075  * the file open (and or more for write).  Reads and writes bypass the
0076  * page cache and go directly to the OSD.  Setting this flag on a file
0077  * descriptor will allow buffered IO for this file in cases where the
0078  * application knows it won't interfere with other nodes (or doesn't
0079  * care).
0080  */
0081 #define CEPH_IOC_LAZYIO _IO(CEPH_IOCTL_MAGIC, 4)
0082 
0083 /*
0084  * CEPH_IOC_SYNCIO - force synchronous IO
0085  *
0086  * This ioctl sets a file flag that forces the synchronous IO that
0087  * bypasses the page cache, even if it is not necessary.  This is
0088  * essentially the opposite behavior of IOC_LAZYIO.  This forces the
0089  * same read/write path as a file opened by multiple clients when one
0090  * or more of those clients is opened for write.
0091  *
0092  * Note that this type of sync IO takes a different path than a file
0093  * opened with O_SYNC/D_SYNC (writes hit the page cache and are
0094  * immediately flushed on page boundaries).  It is very similar to
0095  * O_DIRECT (writes bypass the page cache) excep that O_DIRECT writes
0096  * are not copied (user page must remain stable) and O_DIRECT writes
0097  * have alignment restrictions (on the buffer and file offset).
0098  */
0099 #define CEPH_IOC_SYNCIO _IO(CEPH_IOCTL_MAGIC, 5)
0100 
0101 #endif