ioctl.h 3.6 KB

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