Stability | provisional |
---|---|
Portability | non-portable (requires Linux) |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
This module can be used to retrieve information about how a particular file is stored on disk (i.e. the file fragmentation). It accomplishes that by calling the FIEMAP ioctl provided by recent versions of the Linux kernel. This ioctl is specific to Linux and therefore this module is not portable.
For more information about the FIEMAP ioctl see filesystems/fiemap.txt
in the kernel documentation.
Synopsis
- type ExtentFlags = Word32
- efLast :: ExtentFlags
- efUnknown :: ExtentFlags
- efDelalloc :: ExtentFlags
- efEncoded :: ExtentFlags
- efDataEncrypted :: ExtentFlags
- efNotAligned :: ExtentFlags
- efDataInline :: ExtentFlags
- efDataTail :: ExtentFlags
- efUnwritten :: ExtentFlags
- efMerged :: ExtentFlags
- efShared :: ExtentFlags
- data Extent = Extent {}
- data ReqFlags = ReqFlags {}
- defReqFlags :: ReqFlags
- getExtentsFd :: ReqFlags -> Fd -> Maybe (Word64, Word64) -> IO [Extent]
- getExtents :: ReqFlags -> FilePath -> Maybe (Word64, Word64) -> IO [Extent]
- getExtentCountFd :: ReqFlags -> Fd -> Maybe (Word64, Word64) -> IO Word32
- getExtentCount :: ReqFlags -> FilePath -> Maybe (Word64, Word64) -> IO Word32
Extent flags
See filesystems/fiemap.txt
in the kernel documentation for a more
detailed description of each of these flags.
type ExtentFlags = Word32 Source #
efLast :: ExtentFlags Source #
Last extent in file.
efUnknown :: ExtentFlags Source #
Data location unknown.
efDelalloc :: ExtentFlags Source #
Location still pending.
efEncoded :: ExtentFlags Source #
Data cannot be read while fs is unmounted.
efDataEncrypted :: ExtentFlags Source #
Data is encrypted by fs.
efNotAligned :: ExtentFlags Source #
Extent offsets may not be block aligned.
efDataInline :: ExtentFlags Source #
Data mixed with metadata.
efDataTail :: ExtentFlags Source #
Multiple files in block.
efUnwritten :: ExtentFlags Source #
Space allocated, but no data (i.e. zero).
efMerged :: ExtentFlags Source #
File does not natively support extents. Result merged for efficiency.
efShared :: ExtentFlags Source #
Space shared with other files.
Extents
Description of a single extent. All offsets and lengths are in bytes.
Extent | |
|
Instances
Storable Extent Source # | |
Show Extent Source # | |
Eq Extent Source # | |
Request flags
defReqFlags :: ReqFlags Source #
Default values for the request flags. All options are disabled.
Getting extent information
:: ReqFlags | |
-> Fd | |
-> Maybe (Word64, Word64) | The range (offset and length) within the file to look extents for. Use |
-> IO [Extent] |
Retrieve the list of all extents associated with the file referenced by the file descriptor. Extents returned mirror those on disk - that is, the logical offset of the first returned extent may start before the requested range, and the last returned extent may end after the end of the requested range.
Note: getExtentsFd
might call the FIEMAP ioctl multiple times in order to
retrieve all the extents of the file. This is necessary when the file
has too many fragments. If the file is modified in the meantime, the
returned list might be inconsistent.
getExtents :: ReqFlags -> FilePath -> Maybe (Word64, Word64) -> IO [Extent] Source #
Like getExtentsFd
except that it operates on file paths instead of
file descriptors.