Sage Weil | 8f4e91d | 2009-10-06 11:31:14 -0700 | [diff] [blame] | 1 | #ifndef FS_CEPH_IOCTL_H |
| 2 | #define FS_CEPH_IOCTL_H |
| 3 | |
| 4 | #include <linux/ioctl.h> |
| 5 | #include <linux/types.h> |
| 6 | |
Sage Weil | 1cd275f | 2010-12-06 09:45:22 -0800 | [diff] [blame] | 7 | #define CEPH_IOCTL_MAGIC 0x97 |
Sage Weil | 8f4e91d | 2009-10-06 11:31:14 -0700 | [diff] [blame] | 8 | |
Sage Weil | 6a8ea47 | 2011-08-04 15:41:37 -0700 | [diff] [blame] | 9 | /* |
| 10 | * CEPH_IOC_GET_LAYOUT - get file layout or dir layout policy |
| 11 | * CEPH_IOC_SET_LAYOUT - set file layout |
| 12 | * CEPH_IOC_SET_LAYOUT_POLICY - set dir layout policy |
| 13 | * |
| 14 | * The file layout specifies how file data is striped over objects in |
| 15 | * the distributed object store, which object pool they belong to (if |
| 16 | * it differs from the default), and an optional 'preferred osd' to |
| 17 | * store them on. |
| 18 | * |
| 19 | * Files get a new layout based on the policy set on the containing |
| 20 | * directory or one of its ancestors. The GET_LAYOUT ioctl will let |
| 21 | * you examine the layout for a file or the policy on a directory. |
| 22 | * |
| 23 | * SET_LAYOUT will let you set a layout on a newly created file. This |
| 24 | * only works immediately after the file is created and before any |
| 25 | * data is written to it. |
| 26 | * |
| 27 | * SET_LAYOUT_POLICY will let you set a layout policy (default layout) |
| 28 | * on a directory that will apply to any new files created in that |
| 29 | * directory (or any child directory that doesn't specify a layout of |
| 30 | * its own). |
| 31 | */ |
| 32 | |
| 33 | /* use u64 to align sanely on all archs */ |
Sage Weil | 8f4e91d | 2009-10-06 11:31:14 -0700 | [diff] [blame] | 34 | struct ceph_ioctl_layout { |
| 35 | __u64 stripe_unit, stripe_count, object_size; |
| 36 | __u64 data_pool; |
Sage Weil | 33d4909 | 2009-12-02 14:42:39 -0800 | [diff] [blame] | 37 | __s64 preferred_osd; |
Sage Weil | 8f4e91d | 2009-10-06 11:31:14 -0700 | [diff] [blame] | 38 | }; |
| 39 | |
| 40 | #define CEPH_IOC_GET_LAYOUT _IOR(CEPH_IOCTL_MAGIC, 1, \ |
| 41 | struct ceph_ioctl_layout) |
| 42 | #define CEPH_IOC_SET_LAYOUT _IOW(CEPH_IOCTL_MAGIC, 2, \ |
| 43 | struct ceph_ioctl_layout) |
Greg Farnum | 571dba5 | 2010-09-24 14:56:40 -0700 | [diff] [blame] | 44 | #define CEPH_IOC_SET_LAYOUT_POLICY _IOW(CEPH_IOCTL_MAGIC, 5, \ |
| 45 | struct ceph_ioctl_layout) |
Sage Weil | 8f4e91d | 2009-10-06 11:31:14 -0700 | [diff] [blame] | 46 | |
| 47 | /* |
Sage Weil | 6a8ea47 | 2011-08-04 15:41:37 -0700 | [diff] [blame] | 48 | * CEPH_IOC_GET_DATALOC - get location of file data in the cluster |
| 49 | * |
Sage Weil | 8f4e91d | 2009-10-06 11:31:14 -0700 | [diff] [blame] | 50 | * Extract identity, address of the OSD and object storing a given |
| 51 | * file offset. |
| 52 | */ |
| 53 | struct ceph_ioctl_dataloc { |
| 54 | __u64 file_offset; /* in+out: file offset */ |
| 55 | __u64 object_offset; /* out: offset in object */ |
| 56 | __u64 object_no; /* out: object # */ |
| 57 | __u64 object_size; /* out: object size */ |
| 58 | char object_name[64]; /* out: object name */ |
| 59 | __u64 block_offset; /* out: offset in block */ |
| 60 | __u64 block_size; /* out: block length */ |
| 61 | __s64 osd; /* out: osd # */ |
| 62 | struct sockaddr_storage osd_addr; /* out: osd address */ |
| 63 | }; |
| 64 | |
| 65 | #define CEPH_IOC_GET_DATALOC _IOWR(CEPH_IOCTL_MAGIC, 3, \ |
| 66 | struct ceph_ioctl_dataloc) |
| 67 | |
Sage Weil | 6a8ea47 | 2011-08-04 15:41:37 -0700 | [diff] [blame] | 68 | /* |
| 69 | * CEPH_IOC_LAZYIO - relax consistency |
| 70 | * |
| 71 | * Normally Ceph switches to synchronous IO when multiple clients have |
| 72 | * the file open (and or more for write). Reads and writes bypass the |
| 73 | * page cache and go directly to the OSD. Setting this flag on a file |
| 74 | * descriptor will allow buffered IO for this file in cases where the |
| 75 | * application knows it won't interfere with other nodes (or doesn't |
| 76 | * care). |
| 77 | */ |
Sage Weil | 8c6e922 | 2010-04-16 09:53:43 -0700 | [diff] [blame] | 78 | #define CEPH_IOC_LAZYIO _IO(CEPH_IOCTL_MAGIC, 4) |
Sage Weil | 6a8ea47 | 2011-08-04 15:41:37 -0700 | [diff] [blame] | 79 | |
| 80 | /* |
| 81 | * CEPH_IOC_SYNCIO - force synchronous IO |
| 82 | * |
| 83 | * This ioctl sets a file flag that forces the synchronous IO that |
| 84 | * bypasses the page cache, even if it is not necessary. This is |
| 85 | * essentially the opposite behavior of IOC_LAZYIO. This forces the |
| 86 | * same read/write path as a file opened by multiple clients when one |
| 87 | * or more of those clients is opened for write. |
| 88 | * |
| 89 | * Note that this type of sync IO takes a different path than a file |
| 90 | * opened with O_SYNC/D_SYNC (writes hit the page cache and are |
| 91 | * immediately flushed on page boundaries). It is very similar to |
| 92 | * O_DIRECT (writes bypass the page cache) excep that O_DIRECT writes |
| 93 | * are not copied (user page must remain stable) and O_DIRECT writes |
| 94 | * have alignment restrictions (on the buffer and file offset). |
| 95 | */ |
Sage Weil | 4918b6d | 2011-07-26 11:26:07 -0700 | [diff] [blame] | 96 | #define CEPH_IOC_SYNCIO _IO(CEPH_IOCTL_MAGIC, 5) |
Sage Weil | 8c6e922 | 2010-04-16 09:53:43 -0700 | [diff] [blame] | 97 | |
Sage Weil | 8f4e91d | 2009-10-06 11:31:14 -0700 | [diff] [blame] | 98 | #endif |