On Sun, Sep 13, 2009 at 11:08 PM, Manish Katiyar <mkatiyar@xxxxxxxxx> wrote: > On Sun, Sep 13, 2009 at 10:12 PM, SandeepKsinha <sandeepksinha@xxxxxxxxx> wrote: >> Hi, >> >> >> On Sun, Sep 13, 2009 at 10:07 PM, Manish Katiyar <mkatiyar@xxxxxxxxx> wrote: >>> On Sun, Sep 13, 2009 at 5:44 PM, SandeepKsinha <sandeepksinha@xxxxxxxxx> wrote: >>>> Hi all, >>>> >>>> Looking at the flags in the extent info, Is there any specifc flags >>>> which indicates an extent to be a HOLE?? >>> >>> I am not sure if I understand the question correctly ...... why would >>> you need that ? Can you give an example where it should be used ?? >>> >> >> Look at e4defrag.c, >> it checks the file size and allocates the same number of blocks for >> donor inode. Which will eventually make a holey file into a normal >> one. >> Any tool/application should make sure that they leave a sparse file as sparse. >> >> I think, as suggested by Greg Freemyer, we can use BMAP ioctl to get >> such information. > > Yes, but I think bmap would be costly if the file is large and is not > holey :-( .... but that would be probably same calling fiemap if the > file is completely fragmented such that each extent size is 1. > Since, ext2/ext3 did not have mutli block allocation thats why this is the only way that we might have. But generally most of the new features work on with extent based files on ext4. I am still wondering that how to we represent a hole using extents in a extent based file. Just like we had a convention of having the block number 0 in case of holes. Similarly, what do we look at to figure out if its a hole or not. BMAP is one way. But since, in a extent based file, we have only extents, there should be some flag to indicate the same. > >> >> >>>> >>>> I could only find the following ones... >>>> >>>> 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 */ >>>> 43 >>>> 44#define FIEMAP_FLAGS_COMPAT (FIEMAP_FLAG_SYNC | FIEMAP_FLAG_XATTR) >>>> 45 >>>> 46#define FIEMAP_EXTENT_LAST 0x00000001 /* Last extent >>>> in file. */ >>>> 47#define FIEMAP_EXTENT_UNKNOWN 0x00000002 /* Data >>>> location unknown. */ >>>> 48#define FIEMAP_EXTENT_DELALLOC 0x00000004 /* Location >>>> still pending. >>>> 49 * Sets >>>> EXTENT_UNKNOWN. */ >>>> 50#define FIEMAP_EXTENT_ENCODED 0x00000008 /* Data can not be read >>>> 51 * while fs is >>>> unmounted */ >>>> 52#define FIEMAP_EXTENT_DATA_ENCRYPTED 0x00000080 /* Data is >>>> encrypted by fs. >>>> 53 * Sets >>>> EXTENT_NO_BYPASS. */ >>>> 54#define FIEMAP_EXTENT_NOT_ALIGNED 0x00000100 /* Extent >>>> offsets may not be >>>> 55 * block aligned. */ >>>> 56#define FIEMAP_EXTENT_DATA_INLINE 0x00000200 /* Data mixed >>>> with metadata. >>>> 57 * Sets >>>> EXTENT_NOT_ALIGNED.*/ >>>> 58#define FIEMAP_EXTENT_DATA_TAIL 0x00000400 /* Multiple >>>> files in block. >>>> 59 * Sets >>>> EXTENT_NOT_ALIGNED.*/ >>>> 60#define FIEMAP_EXTENT_UNWRITTEN 0x00000800 /* Space allocated, but >>>> 61 * no data >>>> (i.e. zero). */ >>>> 62#define FIEMAP_EXTENT_MERGED 0x00001000 /* File does not natively >>>> 63 * support >>>> extents. Result >>>> 64 * merged for >>>> efficiency. */ >>>> >>>> >>>> -- >>>> Regards, >>>> Sandeep. >>>> >>>> >>>> >>>> >>>> >>>> >>>> “To learn is to change. Education is a process that changes the learner.” >>>> >>>> -- >>>> To unsubscribe from this list: send an email with >>>> "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx >>>> Please read the FAQ at http://kernelnewbies.org/FAQ >>>> >>>> >>> >>> >>> >>> -- >>> Thanks - >>> Manish >>> >> >> >> >> -- >> Regards, >> Sandeep. >> >> >> >> >> >> >> “To learn is to change. Education is a process that changes the learner.” >> > > > > -- > Thanks - > Manish > -- Regards, Sandeep. “To learn is to change. Education is a process that changes the learner.” -- To unsubscribe from this list: send an email with "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx Please read the FAQ at http://kernelnewbies.org/FAQ