Commit 220ebc4334326bc23e4c4c3f076dc5a58ec293f6

Authored by Tristan Ye
1 parent 3e19a25e05

Ocfs2/move_extents: Adding new ioctl code 'OCFS2_IOC_MOVE_EXT' to ocfs2.

Patch also manages to add a manipulative struture for this ioctl.

Signed-off-by: Tristan Ye <tristan.ye@oracle.com>

Showing 1 changed file with 34 additions and 0 deletions Side-by-side Diff

fs/ocfs2/ocfs2_ioctl.h
... ... @@ -205,5 +205,39 @@
205 205  
206 206 #define OCFS2_IOC_INFO _IOR('o', 5, struct ocfs2_info)
207 207  
  208 +struct ocfs2_move_extents {
  209 +/* All values are in bytes */
  210 + /* in */
  211 + __u64 me_start; /* Virtual start in the file to move */
  212 + __u64 me_len; /* Length of the extents to be moved */
  213 + __u64 me_goal; /* Physical offset of the goal,
  214 + it's in block unit */
  215 + __u64 me_threshold; /* Maximum distance from goal or threshold
  216 + for auto defragmentation */
  217 + __u64 me_flags; /* Flags for the operation:
  218 + * - auto defragmentation.
  219 + * - refcount,xattr cases.
  220 + */
  221 + /* out */
  222 + __u64 me_moved_len; /* Moved/defraged length */
  223 + __u64 me_new_offset; /* Resulting physical location */
  224 + __u32 me_reserved[2]; /* Reserved for futhure */
  225 +};
  226 +
  227 +#define OCFS2_MOVE_EXT_FL_AUTO_DEFRAG (0x00000001) /* Kernel manages to
  228 + claim new clusters
  229 + as the goal place
  230 + for extents moving */
  231 +#define OCFS2_MOVE_EXT_FL_PART_DEFRAG (0x00000002) /* Allow partial extent
  232 + moving, is to make
  233 + movement less likely
  234 + to fail, may make fs
  235 + even more fragmented */
  236 +#define OCFS2_MOVE_EXT_FL_COMPLETE (0x00000004) /* Move or defragmenation
  237 + completely gets done.
  238 + */
  239 +
  240 +#define OCFS2_IOC_MOVE_EXT _IOW('o', 6, struct ocfs2_move_extents)
  241 +
208 242 #endif /* OCFS2_IOCTL_H */