blob: 0c51d617dae9cf131a8c5a009d0ecf3cac5da735 [file] [log] [blame]
Mark Fashehc4b929b2008-10-08 19:44:18 -04001/*
2 * FS_IOC_FIEMAP ioctl infrastructure.
3 *
4 * Some portions copyright (C) 2007 Cluster File Systems, Inc
5 *
6 * Authors: Mark Fasheh <mfasheh@suse.com>
7 * Kalpak Shah <kalpak.shah@sun.com>
8 * Andreas Dilger <adilger@sun.com>
9 */
10
11#ifndef _LINUX_FIEMAP_H
12#define _LINUX_FIEMAP_H
13
Eric Sandeen5dec8bf2009-04-13 14:39:54 -070014#include <linux/types.h>
15
Mark Fashehc4b929b2008-10-08 19:44:18 -040016struct fiemap_extent {
17 __u64 fe_logical; /* logical offset in bytes for the start of
18 * the extent from the beginning of the file */
19 __u64 fe_physical; /* physical offset in bytes for the start
20 * of the extent from the beginning of the disk */
21 __u64 fe_length; /* length in bytes for this extent */
22 __u64 fe_reserved64[2];
23 __u32 fe_flags; /* FIEMAP_EXTENT_* flags for this extent */
24 __u32 fe_reserved[3];
25};
26
27struct fiemap {
28 __u64 fm_start; /* logical offset (inclusive) at
29 * which to start mapping (in) */
30 __u64 fm_length; /* logical length of mapping which
31 * userspace wants (in) */
32 __u32 fm_flags; /* FIEMAP_FLAG_* flags for request (in/out) */
33 __u32 fm_mapped_extents;/* number of extents that were mapped (out) */
34 __u32 fm_extent_count; /* size of fm_extents array (in) */
35 __u32 fm_reserved;
36 struct fiemap_extent fm_extents[0]; /* array of mapped extents (out) */
37};
38
39#define FIEMAP_MAX_OFFSET (~0ULL)
40
41#define FIEMAP_FLAG_SYNC 0x00000001 /* sync file data before map */
42#define FIEMAP_FLAG_XATTR 0x00000002 /* map extended attribute tree */
Theodore Ts'o7869a4a2013-08-16 22:05:14 -040043#define FIEMAP_FLAG_CACHE 0x00000004 /* request caching of the extents */
Mark Fashehc4b929b2008-10-08 19:44:18 -040044
45#define FIEMAP_FLAGS_COMPAT (FIEMAP_FLAG_SYNC | FIEMAP_FLAG_XATTR)
46
47#define FIEMAP_EXTENT_LAST 0x00000001 /* Last extent in file. */
48#define FIEMAP_EXTENT_UNKNOWN 0x00000002 /* Data location unknown. */
49#define FIEMAP_EXTENT_DELALLOC 0x00000004 /* Location still pending.
50 * Sets EXTENT_UNKNOWN. */
51#define FIEMAP_EXTENT_ENCODED 0x00000008 /* Data can not be read
52 * while fs is unmounted */
53#define FIEMAP_EXTENT_DATA_ENCRYPTED 0x00000080 /* Data is encrypted by fs.
54 * Sets EXTENT_NO_BYPASS. */
55#define FIEMAP_EXTENT_NOT_ALIGNED 0x00000100 /* Extent offsets may not be
56 * block aligned. */
57#define FIEMAP_EXTENT_DATA_INLINE 0x00000200 /* Data mixed with metadata.
58 * Sets EXTENT_NOT_ALIGNED.*/
59#define FIEMAP_EXTENT_DATA_TAIL 0x00000400 /* Multiple files in block.
60 * Sets EXTENT_NOT_ALIGNED.*/
61#define FIEMAP_EXTENT_UNWRITTEN 0x00000800 /* Space allocated, but
62 * no data (i.e. zero). */
63#define FIEMAP_EXTENT_MERGED 0x00001000 /* File does not natively
64 * support extents. Result
65 * merged for efficiency. */
Sunil Mushran8c0414c2009-12-03 12:46:51 -080066#define FIEMAP_EXTENT_SHARED 0x00002000 /* Space shared with other
67 * files. */
Mark Fashehc4b929b2008-10-08 19:44:18 -040068
69#endif /* _LINUX_FIEMAP_H */