Whamcloud - gitweb
Branch b1_8
[fs/lustre-release.git] / ldiskfs / kernel_patches / patches / ext4-fiemap-2.6-rhel5.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.18.i386/fs/ext4/ioctl.c
5 ===================================================================
6 --- linux-2.6.18.i386.orig/fs/ext4/ioctl.c
7 +++ linux-2.6.18.i386/fs/ext4/ioctl.c
8 @@ -17,6 +17,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 @@ -257,6 +413,10 @@ flags_err:
172         case EXT4_IOC_MIGRATE:
173                 return ext4_ext_migrate(inode, filp, cmd, arg);
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.18.i386/fs/ext4/ext4.h
183 ===================================================================
184 --- linux-2.6.18.i386.orig/fs/ext4/ext4.h
185 +++ linux-2.6.18.i386/fs/ext4/ext4.h
186 @@ -300,6 +300,7 @@ struct ext4_new_group_data {
187  #define EXT4_IOC_GETRSVSZ              _IOR('f', 5, long)
188  #define EXT4_IOC_SETRSVSZ              _IOW('f', 6, long)
189  #define EXT4_IOC_MIGRATE               _IO('f', 7)
190 +#define EXT4_IOC_FIEMAP                        _IOWR('f', 11, struct fiemap)
191  
192  /*
193   * ioctl commands in 32 bit emulation
194 @@ -317,6 +318,8 @@ struct ext4_new_group_data {
195  #define EXT4_IOC32_GETVERSION_OLD      FS_IOC32_GETVERSION
196  #define EXT4_IOC32_SETVERSION_OLD      FS_IOC32_SETVERSION
197  
198 +/* FIEMAP flags supported by ext4 */
199 +#define EXT4_FIEMAP_FLAGS_COMPAT (FIEMAP_FLAG_SYNC)
200  
201  /*
202   *  Mount options
203 @@ -1115,6 +1118,9 @@ extern int ext4_page_mkwrite(struct vm_a
204  /* ioctl.c */
205  extern long ext4_ioctl(struct file *, unsigned int, unsigned long);
206  extern long ext4_compat_ioctl (struct file *, unsigned int, unsigned long);
207 +struct fiemap_extent_info;
208 +extern int ext4_fiemap(struct inode *, struct fiemap_extent_info *, __u64,
209 +                      __u64);
210  
211  /* migrate.c */
212  extern int ext4_ext_migrate(struct inode *, struct file *, unsigned int,
213 Index: linux-2.6.18.i386/fs/ext4/ext4_extents.h
214 ===================================================================
215 --- linux-2.6.18.i386.orig/fs/ext4/ext4_extents.h
216 +++ linux-2.6.18.i386/fs/ext4/ext4_extents.h
217 @@ -128,6 +128,22 @@ struct ext4_ext_path {
218  #define EXT_MAX_BLOCK  0xffffffff
219  
220  /*
221 + * to be called by ext4_ext_walk_space()
222 + * negative retcode - error
223 + * positive retcode - signal for ext4_ext_walk_space(), see below
224 + * callback must return valid extent (passed or newly created)
225 + */
226 +typedef int (*ext_prepare_callback)(struct inode *, struct ext4_ext_path *,
227 +                                   struct ext4_ext_cache *,
228 +                                   struct ext4_extent *, void *);
229 +
230 +#define HAVE_EXT_PREPARE_CB_EXTENT
231 +
232 +#define EXT_CONTINUE   0
233 +#define EXT_BREAK      1
234 +#define EXT_REPEAT     2
235 +
236 +/*
237   * EXT_INIT_MAX_LEN is the maximum number of blocks we can have in an
238   * initialized extent. This is 2^15 and not (2^16 - 1), since we use the
239   * MSB of ee_len field in the extent datastructure to signify if this
240 @@ -223,6 +239,8 @@ extern int ext4_ext_try_to_merge(struct 
241                                  struct ext4_extent *);
242  extern unsigned int ext4_ext_check_overlap(struct inode *, struct ext4_extent *, struct ext4_ext_path *);
243  extern int ext4_ext_insert_extent(handle_t *, struct inode *, struct ext4_ext_path *, struct ext4_extent *);
244 +extern int ext4_ext_walk_space(struct inode *, ext4_lblk_t, ext4_lblk_t,
245 +                              ext_prepare_callback, void *);
246  extern struct ext4_ext_path *ext4_ext_find_extent(struct inode *, ext4_lblk_t,
247                                                         struct ext4_ext_path *);
248  extern int ext4_ext_search_left(struct inode *, struct ext4_ext_path *,
249 Index: linux-2.6.18.i386/fs/ext4/extents.c
250 ===================================================================
251 --- linux-2.6.18.i386.orig/fs/ext4/extents.c
252 +++ linux-2.6.18.i386/fs/ext4/extents.c
253 @@ -44,7 +44,7 @@
254  #include <asm/uaccess.h>
255  #include "ext4_jbd2.h"
256  #include "ext4_extents.h"
257 -
258 +#include "fiemap.h"
259  
260  /*
261   * ext_pblock:
262 @@ -1597,6 +1597,113 @@ cleanup:
263         return err;
264  }
265  
266 +int ext4_ext_walk_space(struct inode *inode, ext4_lblk_t block,
267 +                       ext4_lblk_t num, ext_prepare_callback func,
268 +                       void *cbdata)
269 +{
270 +       struct ext4_ext_path *path = NULL;
271 +       struct ext4_ext_cache cbex;
272 +       struct ext4_extent *ex;
273 +       ext4_lblk_t next, start = 0, end = 0;
274 +       ext4_lblk_t last = block + num;
275 +       int depth, exists, err = 0;
276 +
277 +       BUG_ON(func == NULL);
278 +       BUG_ON(inode == NULL);
279 +
280 +       while (block < last && block != EXT_MAX_BLOCK) {
281 +               num = last - block;
282 +               /* find extent for this block */
283 +               path = ext4_ext_find_extent(inode, block, path);
284 +               if (IS_ERR(path)) {
285 +                       err = PTR_ERR(path);
286 +                       path = NULL;
287 +                       break;
288 +               }
289 +
290 +               depth = ext_depth(inode);
291 +               BUG_ON(path[depth].p_hdr == NULL);
292 +               ex = path[depth].p_ext;
293 +               next = ext4_ext_next_allocated_block(path);
294 +
295 +               exists = 0;
296 +               if (!ex) {
297 +                       /* there is no extent yet, so try to allocate
298 +                        * all requested space */
299 +                       start = block;
300 +                       end = block + num;
301 +               } else if (le32_to_cpu(ex->ee_block) > block) {
302 +                       /* need to allocate space before found extent */
303 +                       start = block;
304 +                       end = le32_to_cpu(ex->ee_block);
305 +                       if (block + num < end)
306 +                               end = block + num;
307 +               } else if (block >= le32_to_cpu(ex->ee_block)
308 +                                       + ext4_ext_get_actual_len(ex)) {
309 +                       /* need to allocate space after found extent */
310 +                       start = block;
311 +                       end = block + num;
312 +                       if (end >= next)
313 +                               end = next;
314 +               } else if (block >= le32_to_cpu(ex->ee_block)) {
315 +                       /*
316 +                        * some part of requested space is covered
317 +                        * by found extent
318 +                        */
319 +                       start = block;
320 +                       end = le32_to_cpu(ex->ee_block)
321 +                               + ext4_ext_get_actual_len(ex);
322 +                       if (block + num < end)
323 +                               end = block + num;
324 +                       exists = 1;
325 +               } else {
326 +                       BUG();
327 +               }
328 +               BUG_ON(end <= start);
329 +
330 +               if (!exists) {
331 +                       cbex.ec_block = start;
332 +                       cbex.ec_len = end - start;
333 +                       cbex.ec_start = 0;
334 +                       cbex.ec_type = EXT4_EXT_CACHE_GAP;
335 +               } else {
336 +                       cbex.ec_block = le32_to_cpu(ex->ee_block);
337 +                       cbex.ec_len = ext4_ext_get_actual_len(ex);
338 +                       cbex.ec_start = ext_pblock(ex);
339 +                       cbex.ec_type = EXT4_EXT_CACHE_EXTENT;
340 +               }
341 +
342 +               BUG_ON(cbex.ec_len == 0);
343 +               err = func(inode, path, &cbex, ex, cbdata);
344 +               ext4_ext_drop_refs(path);
345 +
346 +               if (err < 0)
347 +                       break;
348 +
349 +               if (err == EXT_REPEAT)
350 +                       continue;
351 +               else if (err == EXT_BREAK) {
352 +                       err = 0;
353 +                       break;
354 +               }
355 +
356 +               if (ext_depth(inode) != depth) {
357 +                       /* depth was changed. we have to realloc path */
358 +                       kfree(path);
359 +                       path = NULL;
360 +               }
361 +
362 +               block = cbex.ec_block + cbex.ec_len;
363 +       }
364 +
365 +       if (path) {
366 +               ext4_ext_drop_refs(path);
367 +               kfree(path);
368 +       }
369 +
370 +       return err;
371 +}
372 +
373  static void
374  ext4_ext_put_in_cache(struct inode *inode, ext4_lblk_t block,
375                         __u32 len, ext4_fsblk_t start, int type)
376 @@ -2953,3 +3060,100 @@ retry:
377         return ret > 0 ? ret2 : ret;
378  }
379  #endif
380 +
381 +/*
382 + * Callback function called for each extent to gather FIEMAP information.
383 + */
384 +int ext4_ext_fiemap_cb(struct inode *inode, struct ext4_ext_path *path,
385 +                      struct ext4_ext_cache *newex, struct ext4_extent *ex,
386 +                      void *data)
387 +{
388 +       struct fiemap_extent_info *fieinfo = data;
389 +       unsigned long blksize_bits = inode->i_sb->s_blocksize_bits;
390 +       __u64   logical;
391 +       __u64   physical;
392 +       __u64   length;
393 +       __u32   flags = 0;
394 +       int     error;
395 +
396 +       logical =  (__u64)newex->ec_block << blksize_bits;
397 +
398 +       if (newex->ec_type == EXT4_EXT_CACHE_GAP) {
399 +               pgoff_t offset;
400 +               struct page *page;
401 +               struct buffer_head *bh = NULL;
402 +
403 +               offset = logical >> PAGE_SHIFT;
404 +               page = find_get_page(inode->i_mapping, offset);
405 +               if (!page || !page_has_buffers(page))
406 +                       return EXT_CONTINUE;
407 +
408 +               bh = page_buffers(page);
409 +
410 +               if (!bh)
411 +                       return EXT_CONTINUE;
412 +
413 +               if (buffer_delay(bh)) {
414 +                       flags |= FIEMAP_EXTENT_DELALLOC;
415 +                       page_cache_release(page);
416 +               } else {
417 +                       page_cache_release(page);
418 +                       return EXT_CONTINUE;
419 +               }
420 +       }
421 +
422 +       physical = (__u64)newex->ec_start << blksize_bits;
423 +       length =   (__u64)newex->ec_len << blksize_bits;
424 +
425 +       if (ex && ext4_ext_is_uninitialized(ex))
426 +               flags |= FIEMAP_EXTENT_UNWRITTEN;
427 +
428 +       /*
429 +        * If this extent reaches EXT_MAX_BLOCK, it must be last.
430 +        *
431 +        * Or if ext4_ext_next_allocated_block is EXT_MAX_BLOCK,
432 +        * this indicates no more allocated blocks.
433 +        *
434 +        * XXX this might miss a single-block extent at EXT_MAX_BLOCK
435 +        */
436 +       if (logical + length - 1 == EXT_MAX_BLOCK ||
437 +           ext4_ext_next_allocated_block(path) == EXT_MAX_BLOCK)
438 +               flags |= FIEMAP_EXTENT_LAST;
439 +
440 +       error = fiemap_fill_next_extent(fieinfo, logical, physical,
441 +                                       length, flags, inode->i_sb->s_dev);
442 +       if (error < 0)
443 +               return error;
444 +       if (error == 1)
445 +               return EXT_BREAK;
446 +
447 +       return EXT_CONTINUE;
448 +}
449 +
450 +int ext4_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
451 +               __u64 start, __u64 len)
452 +{
453 +       ext4_fsblk_t start_blk;
454 +       ext4_fsblk_t len_blks;
455 +       int error = 0;
456 +
457 +       if (!(EXT4_I(inode)->i_flags & EXT4_EXTENTS_FL))
458 +               return -EOPNOTSUPP;
459 +
460 +       if (fiemap_check_flags(fieinfo, EXT4_FIEMAP_FLAGS_COMPAT))
461 +               return -EBADR;
462 +
463 +       start_blk = start >> inode->i_sb->s_blocksize_bits;
464 +       len_blks = (len + inode->i_sb->s_blocksize - 1) >> inode->i_sb->s_blocksize_bits;
465 +
466 +       /*
467 +         * Walk the extent tree gathering extent information.
468 +         * ext4_ext_fiemap_cb will push extents back to user.
469 +         */
470 +       down_write(&EXT4_I(inode)->i_data_sem);
471 +       error = ext4_ext_walk_space(inode, start_blk, len_blks,
472 +                                 ext4_ext_fiemap_cb, fieinfo);
473 +       up_write(&EXT4_I(inode)->i_data_sem);
474 +
475 +       return error;
476 +}
477 Index: linux-2.6.18.i386/fs/ext4/fiemap.h
478 ===================================================================
479 --- /dev/null
480 +++ linux-2.6.18.i386/fs/ext4/fiemap.h
481 @@ -0,0 +1,85 @@
482 +/*
483 + * FIEMAP ioctl infrastructure.
484 + *
485 + * Copyright 2008 Sun Microsystems, Inc
486 + *
487 + * Author: Kalpak Shah <kalpak.shah@sun.com>
488 + *      Andreas Dilger <adilger@sun.com>
489 + */
490 +
491 +#ifndef _LINUX_EXT4_FIEMAP_H
492 +#define _LINUX_EXT4_FIEMAP_H
493 +
494 +struct fiemap_extent {
495 +       __u64 fe_logical;  /* logical offset in bytes for the start of
496 +                           * the extent from the beginning of the file */
497 +       __u64 fe_physical; /* physical offset in bytes for the start
498 +                           * of the extent from the beginning of the disk */
499 +       __u64 fe_length;   /* length in bytes for this extent */
500 +       __u64 fe_reserved64[2];
501 +       __u32 fe_flags;    /* FIEMAP_EXTENT_* flags for this extent */
502 +       __u32 fe_device;   /* device number for this extent */
503 +       __u32 fe_reserved[2];
504 +};
505 +
506 +struct fiemap {
507 +       __u64 fm_start;  /* logical offset (inclusive) at
508 +                                * which to start mapping (in) */
509 +       __u64 fm_length;        /* logical length of mapping which
510 +                                * userspace wants (in) */
511 +       __u32 fm_flags;  /* FIEMAP_FLAG_* flags for request (in/out) */
512 +       __u32 fm_mapped_extents;/* number of extents that were mapped (out) */
513 +       __u32 fm_extent_count;  /* size of fm_extents array (in) */
514 +       __u32 fm_reserved;
515 +       struct fiemap_extent fm_extents[0]; /* array of mapped extents (out) */
516 +};
517 +
518 +/*
519 + * FIEMAP helper definition.
520 + */
521 +struct fiemap_extent_info {
522 +       unsigned int    fi_flags;               /* Flags as passed from user */
523 +       unsigned int    fi_extents_mapped;      /* Number of mapped extents */
524 +       unsigned int    fi_extents_max;         /* Size of fiemap_extent array*/
525 +       struct fiemap_extent *fi_extents_start; /* Start of fiemap_extent array */
526 +};
527 +
528 +int fiemap_check_flags(struct fiemap_extent_info *fieinfo, u32 fs_flags);
529 +int fiemap_fill_next_extent(struct fiemap_extent_info *info, u64 logical,
530 +                           u64 phys, u64 len, u32 flags, u32 lun);
531 +
532 +#define        FIEMAP_MAX_OFFSET       (~0ULL)
533 +
534 +#define        FIEMAP_FLAG_SYNC        0x00000001 /* sync file data before map */
535 +#define        FIEMAP_FLAG_XATTR       0x00000002 /* map extended attribute tree */
536 +
537 +/* ldiskfs only supports FLAG_SYNC flag currently */
538 +#define FIEMAP_FLAGS_COMPAT (FIEMAP_FLAG_SYNC | FIEMAP_FLAG_XATTR)
539 +
540 +#define FIEMAP_EXTENT_LAST             0x00000001 /* Last extent in file. */
541 +#define FIEMAP_EXTENT_UNKNOWN          0x00000002 /* Data location unknown. */
542 +#define FIEMAP_EXTENT_DELALLOC         0x00000004 /* Location still pending.
543 +                                                   * Sets EXTENT_UNKNOWN. */
544 +#define FIEMAP_EXTENT_ENCODED          0x00000008 /* Data can not be read
545 +                                                   * while fs is unmounted */
546 +#define FIEMAP_EXTENT_DATA_ENCRYPTED   0x00000080 /* Data is encrypted by fs.
547 +                                                   * Sets EXTENT_NO_DIRECT. */
548 +#define FIEMAP_EXTENT_NOT_ALIGNED      0x00000100 /* Extent offsets may not be
549 +                                                   * block aligned. */
550 +#define FIEMAP_EXTENT_DATA_INLINE      0x00000200 /* Data mixed with metadata.
551 +                                                   * Sets EXTENT_NOT_ALIGNED.*/
552 +#define FIEMAP_EXTENT_DATA_TAIL                0x00000400 /* Multiple files in block.
553 +                                                   * Sets EXTENT_NOT_ALIGNED.*/
554 +#define FIEMAP_EXTENT_UNWRITTEN                0x00000800 /* Space allocated, but
555 +                                                   * no data (i.e. zero). */
556 +#define FIEMAP_EXTENT_MERGED           0x00001000 /* File does not natively
557 +                                                   * support extents. Result
558 +                                                   * merged for efficiency. */
559 +
560 +/* Lustre specific flags - use a high bit, don't conflict with upstream flag */
561 +#define FIEMAP_EXTENT_NO_DIRECT                0x40000000 /* Data mapping undefined */
562 +#define FIEMAP_EXTENT_NET              0x80000000 /* Data stored remotely.
563 +                                                   * Sets NO_DIRECT flag */
564 +
565 +#endif /* _LINUX_EXT4_FIEMAP_H */
566 +