Whamcloud - gitweb
b=19625
[fs/lustre-release.git] / ldiskfs / kernel_patches / patches / ext4-fiemap-2.6-sles11.patch
1 A large part of this code is from the generic VFS code in fs/ioctl.c in the
2 upstream kernel.
3
4 Index: linux-2.6.27.21-0.1/fs/ext4/ioctl.c
5 ===================================================================
6 --- linux-2.6.27.21-0.1.orig/fs/ext4/ioctl.c
7 +++ linux-2.6.27.21-0.1/fs/ext4/ioctl.c
8 @@ -18,6 +18,162 @@
9  #include "ext4_jbd2.h"
10  #include "ext4.h"
11  
12 +#include "fiemap.h"
13 +
14 +/* So that the fiemap access checks can't overflow on 32 bit machines. */
15 +#define FIEMAP_MAX_EXTENTS     (UINT_MAX / sizeof(struct fiemap_extent))
16 +
17 +/**
18 + * fiemap_fill_next_extent - Fiemap helper function
19 + * @fieinfo:   Fiemap context passed into ->fiemap
20 + * @logical:   Extent logical start offset, in bytes
21 + * @phys:      Extent physical start offset, in bytes
22 + * @len:       Extent length, in bytes
23 + * @flags:     FIEMAP_EXTENT flags that describe this extent
24 + * @lun:       LUN on which this extent resides
25 + *
26 + * Called from file system ->fiemap callback. Will populate extent
27 + * info as passed in via arguments and copy to user memory. On
28 + * success, extent count on fieinfo is incremented.
29 + *
30 + * Returns 0 on success, -errno on error, 1 if this was the last
31 + * extent that will fit in user array.
32 + */
33 +#define SET_UNKNOWN_FLAGS      (FIEMAP_EXTENT_DELALLOC)
34 +#define SET_NO_DIRECT_FLAGS    (FIEMAP_EXTENT_DATA_ENCRYPTED   \
35 +                               |FIEMAP_EXTENT_NET)
36 +#define SET_NO_UNMOUNTED_IO_FLAGS       (FIEMAP_EXTENT_DATA_ENCRYPTED)
37 +#define SET_NOT_ALIGNED_FLAGS  (FIEMAP_EXTENT_DATA_TAIL|FIEMAP_EXTENT_DATA_INLINE)
38 +int fiemap_fill_next_extent(struct fiemap_extent_info *fieinfo, u64 logical,
39 +                           u64 phys, u64 len, u32 flags, dev_t dev)
40 +{
41 +       struct fiemap_extent extent = { 0 };
42 +       struct fiemap_extent *dest = fieinfo->fi_extents_start;
43 +
44 +       /* only count the extents */
45 +       if (fieinfo->fi_extents_max == 0) {
46 +               fieinfo->fi_extents_mapped++;
47 +               return (flags & FIEMAP_EXTENT_LAST) ? 1 : 0;
48 +       }
49 +
50 +       if (fieinfo->fi_extents_mapped >= fieinfo->fi_extents_max)
51 +               return 1;
52 +
53 +       if (flags & SET_UNKNOWN_FLAGS)
54 +               flags |= FIEMAP_EXTENT_UNKNOWN;
55 +       if (flags & SET_NO_DIRECT_FLAGS)
56 +               flags |= FIEMAP_EXTENT_NO_DIRECT;
57 +       if (flags & SET_NOT_ALIGNED_FLAGS)
58 +               flags |= FIEMAP_EXTENT_NOT_ALIGNED;
59 +       if (flags & SET_NO_UNMOUNTED_IO_FLAGS)
60 +               flags |= FIEMAP_EXTENT_ENCODED;
61 +
62 +       extent.fe_logical = logical;
63 +       extent.fe_physical = phys;
64 +       extent.fe_length = len;
65 +       extent.fe_flags = flags;
66 +       extent.fe_device = new_encode_dev(dev);
67 +
68 +       dest += fieinfo->fi_extents_mapped;
69 +       if (copy_to_user(dest, &extent, sizeof(extent)))
70 +               return -EFAULT;
71 +
72 +       fieinfo->fi_extents_mapped++;
73 +       if (fieinfo->fi_extents_mapped == fieinfo->fi_extents_max)
74 +               return 1;
75 +
76 +       return (flags & FIEMAP_EXTENT_LAST) ? 1 : 0;
77 +}
78 +
79 +static int fiemap_check_ranges(struct super_block *sb,
80 +                              u64 start, u64 len, u64 *new_len)
81 +{
82 +       *new_len = len;
83 +
84 +       if (len == 0)
85 +               return -EINVAL;
86 +
87 +       if (start > sb->s_maxbytes)
88 +               return -EFBIG;
89 +
90 +       /*
91 +        * Shrink request scope to what the fs can actually handle.
92 +        */
93 +       if ((len > sb->s_maxbytes) ||
94 +           (sb->s_maxbytes - len) < start)
95 +               *new_len = sb->s_maxbytes - start;
96 +
97 +       return 0;
98 +}
99 +
100 +/*
101 + * fiemap_check_flags - check validity of requested flags for fiemap
102 + * @fieinfo:   Fiemap context passed into ->fiemap
103 + * @fs_flags:  Set of fiemap flags that the file system understands
104 + *
105 + * Called from file system ->fiemap callback. This will compute the
106 + * intersection of valid fiemap flags and those that the fs supports. That
107 + * value is then compared against the user supplied flags. In case of bad user
108 + * flags, the invalid values will be written into the fieinfo structure, and
109 + * -EBADR is returned, which tells ioctl_fiemap() to return those values to
110 + * userspace. For this reason, a return code of -EBADR should be preserved.
111 + *
112 + * Returns 0 on success, -EBADR on bad flags.
113 + */
114 +int fiemap_check_flags(struct fiemap_extent_info *fieinfo, u32 fs_flags)
115 +{
116 +       u32 incompat_flags;
117 +
118 +       incompat_flags = fieinfo->fi_flags & ~(FIEMAP_FLAGS_COMPAT & fs_flags);
119 +       if (incompat_flags) {
120 +               fieinfo->fi_flags = incompat_flags;
121 +               return -EBADR;
122 +       }
123 +
124 +       return 0;
125 +}
126 +
127 +int ioctl_fiemap(struct inode *inode, struct file *filp, unsigned long arg)
128 +{
129 +       struct fiemap fiemap;
130 +       u64 len;
131 +       struct fiemap_extent_info fieinfo = {0, };
132 +       struct super_block *sb = inode->i_sb;
133 +       int error = 0;
134 +
135 +       if (copy_from_user(&fiemap, (struct fiemap __user *) arg,
136 +                          sizeof(struct fiemap)))
137 +                return -EFAULT;
138 +
139 +       if (fiemap.fm_extent_count > FIEMAP_MAX_EXTENTS)
140 +               return -EINVAL;
141 +
142 +       error = fiemap_check_ranges(sb, fiemap.fm_start, fiemap.fm_length,
143 +                                   &len);
144 +       if (error)
145 +               return error;
146 +
147 +       fieinfo.fi_flags = fiemap.fm_flags;
148 +       fieinfo.fi_extents_max = fiemap.fm_extent_count;
149 +       fieinfo.fi_extents_start = (struct fiemap_extent *)(arg + sizeof(fiemap));
150 +
151 +       if (fiemap.fm_extent_count != 0 &&
152 +           !access_ok(VERIFY_WRITE, (void *)arg,
153 +                      offsetof(typeof(fiemap), fm_extents[fiemap.fm_extent_count])))
154 +               return -EFAULT;
155 +
156 +       if (fieinfo.fi_flags & FIEMAP_FLAG_SYNC)
157 +               filemap_write_and_wait(inode->i_mapping);
158 +
159 +       error = ext4_fiemap(inode, &fieinfo, fiemap.fm_start, len);
160 +       fiemap.fm_flags = fieinfo.fi_flags;
161 +       fiemap.fm_mapped_extents = fieinfo.fi_extents_mapped;
162 +       if (copy_to_user((char *)arg, &fiemap, sizeof(fiemap)))
163 +               error = -EFAULT;
164 +
165 +       return error;
166 +}
167 +
168  long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
169  {
170         struct inode *inode = filp->f_dentry->d_inode;
171 @@ -263,6 +419,10 @@ setversion_out:
172                 return err;
173         }
174  
175 +       case EXT4_IOC_FIEMAP: {
176 +               return ioctl_fiemap(inode, filp, arg);
177 +       }
178 +
179         default:
180                 return -ENOTTY;
181         }
182 Index: linux-2.6.27.21-0.1/fs/ext4/ext4.h
183 ===================================================================
184 --- linux-2.6.27.21-0.1.orig/fs/ext4/ext4.h
185 +++ linux-2.6.27.21-0.1/fs/ext4/ext4.h
186 @@ -302,7 +302,8 @@ struct ext4_new_group_data {
187  #define EXT4_IOC_GROUP_EXTEND          _IOW('f', 7, unsigned long)
188  #define EXT4_IOC_GROUP_ADD             _IOW('f', 8, struct ext4_new_group_input)
189  #define EXT4_IOC_MIGRATE               _IO('f', 9)
190 - /* note ioctl 11 reserved for filesystem-independent FIEMAP ioctl */
191 +#define EXT4_IOC_FIEMAP                        _IOWR('f', 11, struct fiemap)
192 +
193  
194  /*
195   * ioctl commands in 32 bit emulation
196 @@ -320,6 +321,8 @@ struct ext4_new_group_data {
197  #define EXT4_IOC32_GETVERSION_OLD      FS_IOC32_GETVERSION
198  #define EXT4_IOC32_SETVERSION_OLD      FS_IOC32_SETVERSION
199  
200 +/* FIEMAP flags supported by ext4 */
201 +#define EXT4_FIEMAP_FLAGS_COMPAT (FIEMAP_FLAG_SYNC)
202  
203  /*
204   *  Mount options
205 @@ -1130,6 +1133,9 @@ extern int ext4_page_mkwrite(struct vm_a
206  /* ioctl.c */
207  extern long ext4_ioctl(struct file *, unsigned int, unsigned long);
208  extern long ext4_compat_ioctl(struct file *, unsigned int, unsigned long);
209 +struct fiemap_extent_info;
210 +extern int ext4_fiemap(struct inode *, struct fiemap_extent_info *, __u64,
211 +                      __u64);
212  
213  /* migrate.c */
214  extern int ext4_ext_migrate(struct inode *);
215 Index: linux-2.6.27.21-0.1/fs/ext4/ext4_extents.h
216 ===================================================================
217 --- linux-2.6.27.21-0.1.orig/fs/ext4/ext4_extents.h
218 +++ linux-2.6.27.21-0.1/fs/ext4/ext4_extents.h
219 @@ -128,6 +128,22 @@ struct ext4_ext_path {
220  #define EXT_MAX_BLOCK  0xffffffff
221  
222  /*
223 + * to be called by ext4_ext_walk_space()
224 + * negative retcode - error
225 + * positive retcode - signal for ext4_ext_walk_space(), see below
226 + * callback must return valid extent (passed or newly created)
227 + */
228 +typedef int (*ext_prepare_callback)(struct inode *, struct ext4_ext_path *,
229 +                                   struct ext4_ext_cache *,
230 +                                   struct ext4_extent *, void *);
231 +
232 +#define HAVE_EXT_PREPARE_CB_EXTENT
233 +
234 +#define EXT_CONTINUE   0
235 +#define EXT_BREAK      1
236 +#define EXT_REPEAT     2
237 +
238 +/*
239   * EXT_INIT_MAX_LEN is the maximum number of blocks we can have in an
240   * initialized extent. This is 2^15 and not (2^16 - 1), since we use the
241   * MSB of ee_len field in the extent datastructure to signify if this
242 @@ -219,6 +235,8 @@ extern int ext4_ext_try_to_merge(struct 
243                                  struct ext4_extent *);
244  extern unsigned int ext4_ext_check_overlap(struct inode *, struct ext4_extent *, struct ext4_ext_path *);
245  extern int ext4_ext_insert_extent(handle_t *, struct inode *, struct ext4_ext_path *, struct ext4_extent *);
246 +extern int ext4_ext_walk_space(struct inode *, ext4_lblk_t, ext4_lblk_t,
247 +                              ext_prepare_callback, void *);
248  extern struct ext4_ext_path *ext4_ext_find_extent(struct inode *, ext4_lblk_t,
249                                                         struct ext4_ext_path *);
250  extern int ext4_ext_search_left(struct inode *, struct ext4_ext_path *,
251 Index: linux-2.6.27.21-0.1/fs/ext4/extents.c
252 ===================================================================
253 --- linux-2.6.27.21-0.1.orig/fs/ext4/extents.c
254 +++ linux-2.6.27.21-0.1/fs/ext4/extents.c
255 @@ -42,7 +42,7 @@
256  #include <asm/uaccess.h>
257  #include "ext4_jbd2.h"
258  #include "ext4_extents.h"
259 -
260 +#include "fiemap.h"
261  
262  /*
263   * ext_pblock:
264 @@ -1622,6 +1622,113 @@ cleanup:
265         return err;
266  }
267  
268 +int ext4_ext_walk_space(struct inode *inode, ext4_lblk_t block,
269 +                       ext4_lblk_t num, ext_prepare_callback func,
270 +                       void *cbdata)
271 +{
272 +       struct ext4_ext_path *path = NULL;
273 +       struct ext4_ext_cache cbex;
274 +       struct ext4_extent *ex;
275 +       ext4_lblk_t next, start = 0, end = 0;
276 +       ext4_lblk_t last = block + num;
277 +       int depth, exists, err = 0;
278 +
279 +       BUG_ON(func == NULL);
280 +       BUG_ON(inode == NULL);
281 +
282 +       while (block < last && block != EXT_MAX_BLOCK) {
283 +               num = last - block;
284 +               /* find extent for this block */
285 +               path = ext4_ext_find_extent(inode, block, path);
286 +               if (IS_ERR(path)) {
287 +                       err = PTR_ERR(path);
288 +                       path = NULL;
289 +                       break;
290 +               }
291 +
292 +               depth = ext_depth(inode);
293 +               BUG_ON(path[depth].p_hdr == NULL);
294 +               ex = path[depth].p_ext;
295 +               next = ext4_ext_next_allocated_block(path);
296 +
297 +               exists = 0;
298 +               if (!ex) {
299 +                       /* there is no extent yet, so try to allocate
300 +                        * all requested space */
301 +                       start = block;
302 +                       end = block + num;
303 +               } else if (le32_to_cpu(ex->ee_block) > block) {
304 +                       /* need to allocate space before found extent */
305 +                       start = block;
306 +                       end = le32_to_cpu(ex->ee_block);
307 +                       if (block + num < end)
308 +                               end = block + num;
309 +               } else if (block >= le32_to_cpu(ex->ee_block)
310 +                                       + ext4_ext_get_actual_len(ex)) {
311 +                       /* need to allocate space after found extent */
312 +                       start = block;
313 +                       end = block + num;
314 +                       if (end >= next)
315 +                               end = next;
316 +               } else if (block >= le32_to_cpu(ex->ee_block)) {
317 +                       /*
318 +                        * some part of requested space is covered
319 +                        * by found extent
320 +                        */
321 +                       start = block;
322 +                       end = le32_to_cpu(ex->ee_block)
323 +                               + ext4_ext_get_actual_len(ex);
324 +                       if (block + num < end)
325 +                               end = block + num;
326 +                       exists = 1;
327 +               } else {
328 +                       BUG();
329 +               }
330 +               BUG_ON(end <= start);
331 +
332 +               if (!exists) {
333 +                       cbex.ec_block = start;
334 +                       cbex.ec_len = end - start;
335 +                       cbex.ec_start = 0;
336 +                       cbex.ec_type = EXT4_EXT_CACHE_GAP;
337 +               } else {
338 +                       cbex.ec_block = le32_to_cpu(ex->ee_block);
339 +                       cbex.ec_len = ext4_ext_get_actual_len(ex);
340 +                       cbex.ec_start = ext_pblock(ex);
341 +                       cbex.ec_type = EXT4_EXT_CACHE_EXTENT;
342 +               }
343 +
344 +               BUG_ON(cbex.ec_len == 0);
345 +               err = func(inode, path, &cbex, ex, cbdata);
346 +               ext4_ext_drop_refs(path);
347 +
348 +               if (err < 0)
349 +                       break;
350 +
351 +               if (err == EXT_REPEAT)
352 +                       continue;
353 +               else if (err == EXT_BREAK) {
354 +                       err = 0;
355 +                       break;
356 +               }
357 +
358 +               if (ext_depth(inode) != depth) {
359 +                       /* depth was changed. we have to realloc path */
360 +                       kfree(path);
361 +                       path = NULL;
362 +               }
363 +
364 +               block = cbex.ec_block + cbex.ec_len;
365 +       }
366 +
367 +       if (path) {
368 +               ext4_ext_drop_refs(path);
369 +               kfree(path);
370 +       }
371 +
372 +       return err;
373 +}
374 +
375  static void
376  ext4_ext_put_in_cache(struct inode *inode, ext4_lblk_t block,
377                         __u32 len, ext4_fsblk_t start, int type)
378 @@ -2966,3 +3073,100 @@ retry:
379         mutex_unlock(&inode->i_mutex);
380         return ret > 0 ? ret2 : ret;
381  }
382 +
383 +/*
384 + * Callback function called for each extent to gather FIEMAP information.
385 + */
386 +int ext4_ext_fiemap_cb(struct inode *inode, struct ext4_ext_path *path,
387 +                      struct ext4_ext_cache *newex, struct ext4_extent *ex,
388 +                      void *data)
389 +{
390 +       struct fiemap_extent_info *fieinfo = data;
391 +       unsigned long blksize_bits = inode->i_sb->s_blocksize_bits;
392 +       __u64   logical;
393 +       __u64   physical;
394 +       __u64   length;
395 +       __u32   flags = 0;
396 +       int     error;
397 +
398 +       logical =  (__u64)newex->ec_block << blksize_bits;
399 +
400 +       if (newex->ec_type == EXT4_EXT_CACHE_GAP) {
401 +               pgoff_t offset;
402 +               struct page *page;
403 +               struct buffer_head *bh = NULL;
404 +
405 +               offset = logical >> PAGE_SHIFT;
406 +               page = find_get_page(inode->i_mapping, offset);
407 +               if (!page || !page_has_buffers(page))
408 +                       return EXT_CONTINUE;
409 +
410 +               bh = page_buffers(page);
411 +
412 +               if (!bh)
413 +                       return EXT_CONTINUE;
414 +
415 +               if (buffer_delay(bh)) {
416 +                       flags |= FIEMAP_EXTENT_DELALLOC;
417 +                       page_cache_release(page);
418 +               } else {
419 +                       page_cache_release(page);
420 +                       return EXT_CONTINUE;
421 +               }
422 +       }
423 +
424 +       physical = (__u64)newex->ec_start << blksize_bits;
425 +       length =   (__u64)newex->ec_len << blksize_bits;
426 +
427 +       if (ex && ext4_ext_is_uninitialized(ex))
428 +               flags |= FIEMAP_EXTENT_UNWRITTEN;
429 +
430 +       /*
431 +        * If this extent reaches EXT_MAX_BLOCK, it must be last.
432 +        *
433 +        * Or if ext4_ext_next_allocated_block is EXT_MAX_BLOCK,
434 +        * this indicates no more allocated blocks.
435 +        *
436 +        * XXX this might miss a single-block extent at EXT_MAX_BLOCK
437 +        */
438 +       if (logical + length - 1 == EXT_MAX_BLOCK ||
439 +           ext4_ext_next_allocated_block(path) == EXT_MAX_BLOCK)
440 +               flags |= FIEMAP_EXTENT_LAST;
441 +
442 +       error = fiemap_fill_next_extent(fieinfo, logical, physical,
443 +                                       length, flags, inode->i_sb->s_dev);
444 +       if (error < 0)
445 +               return error;
446 +       if (error == 1)
447 +               return EXT_BREAK;
448 +
449 +       return EXT_CONTINUE;
450 +}
451 +
452 +int ext4_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
453 +               __u64 start, __u64 len)
454 +{
455 +       ext4_fsblk_t start_blk;
456 +       ext4_fsblk_t len_blks;
457 +       int error = 0;
458 +
459 +       if (!(EXT4_I(inode)->i_flags & EXT4_EXTENTS_FL))
460 +               return -EOPNOTSUPP;
461 +
462 +       if (fiemap_check_flags(fieinfo, EXT4_FIEMAP_FLAGS_COMPAT))
463 +               return -EBADR;
464 +
465 +       start_blk = start >> inode->i_sb->s_blocksize_bits;
466 +       len_blks = (len + inode->i_sb->s_blocksize - 1) >> inode->i_sb->s_blocksize_bits;
467 +
468 +       /*
469 +        * Walk the extent tree gathering extent information.
470 +        * ext4_ext_fiemap_cb will push extents back to user.
471 +        */
472 +       down_write(&EXT4_I(inode)->i_data_sem);
473 +       error = ext4_ext_walk_space(inode, start_blk, len_blks,
474 +                                 ext4_ext_fiemap_cb, fieinfo);
475 +       up_write(&EXT4_I(inode)->i_data_sem);
476 +
477 +       return error;
478 +}
479 Index: linux-2.6.27.21-0.1/fs/ext4/fiemap.h
480 ===================================================================
481 --- /dev/null
482 +++ linux-2.6.27.21-0.1/fs/ext4/fiemap.h
483 @@ -0,0 +1,85 @@
484 +/*
485 + * FIEMAP ioctl infrastructure.
486 + *
487 + * Copyright 2008 Sun Microsystems, Inc
488 + *
489 + * Author: Kalpak Shah <kalpak.shah@sun.com>
490 + *      Andreas Dilger <adilger@sun.com>
491 + */
492 +
493 +#ifndef _LINUX_EXT4_FIEMAP_H
494 +#define _LINUX_EXT4_FIEMAP_H
495 +
496 +struct fiemap_extent {
497 +       __u64 fe_logical;  /* logical offset in bytes for the start of
498 +                           * the extent from the beginning of the file */
499 +       __u64 fe_physical; /* physical offset in bytes for the start
500 +                           * of the extent from the beginning of the disk */
501 +       __u64 fe_length;   /* length in bytes for this extent */
502 +       __u64 fe_reserved64[2];
503 +       __u32 fe_flags;    /* FIEMAP_EXTENT_* flags for this extent */
504 +       __u32 fe_device;   /* device number for this extent */
505 +       __u32 fe_reserved[2];
506 +};
507 +
508 +struct fiemap {
509 +       __u64 fm_start;  /* logical offset (inclusive) at
510 +                                * which to start mapping (in) */
511 +       __u64 fm_length;        /* logical length of mapping which
512 +                                * userspace wants (in) */
513 +       __u32 fm_flags;  /* FIEMAP_FLAG_* flags for request (in/out) */
514 +       __u32 fm_mapped_extents;/* number of extents that were mapped (out) */
515 +       __u32 fm_extent_count;  /* size of fm_extents array (in) */
516 +       __u32 fm_reserved;
517 +       struct fiemap_extent fm_extents[0]; /* array of mapped extents (out) */
518 +};
519 +
520 +/*
521 + * FIEMAP helper definition.
522 + */
523 +struct fiemap_extent_info {
524 +       unsigned int    fi_flags;               /* Flags as passed from user */
525 +       unsigned int    fi_extents_mapped;      /* Number of mapped extents */
526 +       unsigned int    fi_extents_max;         /* Size of fiemap_extent array*/
527 +       struct fiemap_extent *fi_extents_start; /* Start of fiemap_extent array */
528 +};
529 +
530 +int fiemap_check_flags(struct fiemap_extent_info *fieinfo, u32 fs_flags);
531 +int fiemap_fill_next_extent(struct fiemap_extent_info *info, u64 logical,
532 +                           u64 phys, u64 len, u32 flags, u32 lun);
533 +
534 +#define        FIEMAP_MAX_OFFSET       (~0ULL)
535 +
536 +#define        FIEMAP_FLAG_SYNC        0x00000001 /* sync file data before map */
537 +#define        FIEMAP_FLAG_XATTR       0x00000002 /* map extended attribute tree */
538 +
539 +/* ldiskfs only supports FLAG_SYNC flag currently */
540 +#define FIEMAP_FLAGS_COMPAT (FIEMAP_FLAG_SYNC | FIEMAP_FLAG_XATTR)
541 +
542 +#define FIEMAP_EXTENT_LAST             0x00000001 /* Last extent in file. */
543 +#define FIEMAP_EXTENT_UNKNOWN          0x00000002 /* Data location unknown. */
544 +#define FIEMAP_EXTENT_DELALLOC         0x00000004 /* Location still pending.
545 +                                                   * Sets EXTENT_UNKNOWN. */
546 +#define FIEMAP_EXTENT_ENCODED          0x00000008 /* Data can not be read
547 +                                                   * while fs is unmounted */
548 +#define FIEMAP_EXTENT_DATA_ENCRYPTED   0x00000080 /* Data is encrypted by fs.
549 +                                                   * Sets EXTENT_NO_DIRECT. */
550 +#define FIEMAP_EXTENT_NOT_ALIGNED      0x00000100 /* Extent offsets may not be
551 +                                                   * block aligned. */
552 +#define FIEMAP_EXTENT_DATA_INLINE      0x00000200 /* Data mixed with metadata.
553 +                                                   * Sets EXTENT_NOT_ALIGNED.*/
554 +#define FIEMAP_EXTENT_DATA_TAIL                0x00000400 /* Multiple files in block.
555 +                                                   * Sets EXTENT_NOT_ALIGNED.*/
556 +#define FIEMAP_EXTENT_UNWRITTEN                0x00000800 /* Space allocated, but
557 +                                                   * no data (i.e. zero). */
558 +#define FIEMAP_EXTENT_MERGED           0x00001000 /* File does not natively
559 +                                                   * support extents. Result
560 +                                                   * merged for efficiency. */
561 +
562 +/* Lustre specific flags - use a high bit, don't conflict with upstream flag */
563 +#define FIEMAP_EXTENT_NO_DIRECT                0x40000000 /* Data mapping undefined */
564 +#define FIEMAP_EXTENT_NET              0x80000000 /* Data stored remotely.
565 +                                                   * Sets NO_DIRECT flag */
566 +
567 +#endif /* _LINUX_EXT4_FIEMAP_H */
568 +