1IOCTL-XFS-GETBMAPX(2)         System Calls Manual        IOCTL-XFS-GETBMAPX(2)
2
3
4

NAME

6       ioctl_xfs_getbmapx - query extent information for an open file
7

SYNOPSIS

9       #include <xfs/xfs_fs.h>
10
11       int ioctl(int fd, XFS_IOC_GETBMAP, struct getbmap *arg);
12       int ioctl(int fd, XFS_IOC_GETBMAPA, struct getbmap *arg);
13       int ioctl(int fd, XFS_IOC_GETBMAPX, struct getbmapx *arg);
14

DESCRIPTION

16       Get  the  block map for a segment of a file in an XFS file system.  The
17       mapping information is conveyed via an array of structures of the  fol‐
18       lowing form:
19
20           struct getbmap {
21                __s64   bmv_offset;
22                __s64   bmv_block;
23                __s64   bmv_length;
24                __s32   bmv_count;
25                __s32   bmv_entries;
26           };
27
28       The XFS_IOC_GETBMAPX ioctl uses a larger version of that structure:
29
30           struct getbmapx {
31                __s64   bmv_offset;
32                __s64   bmv_block;
33                __s64   bmv_length;
34                __s32   bmv_count;
35                __s32   bmv_entries;
36                __s32   bmv_iflags;
37                __s32   bmv_oflags;
38                __s32   bmv_unused1;
39                __s32   bmv_unused2;
40           };
41
42       All sizes and offsets in the structure are in units of 512 bytes.
43
44       The  first  structure in the array is a header and the remaining struc‐
45       tures in the array contain block map information on return.  The header
46       controls  iterative  calls  to  the command and should be filled out as
47       follows:
48
49       bmv_offset
50              The file offset of the area of interest in the file.
51
52       bmv_length
53              The length of the area of interest in the file.  If  this  value
54              is  set to -1, the length of the interesting area is the rest of
55              the file.
56
57       bmv_count
58              The number of elements in the array, including this header.  The
59              minimum value is 2.
60
61       bmv_entries
62              The number of entries actually filled in by the call.  This does
63              not need to be filled out before the call.  This  value  may  be
64              zero  if  no  extents  were  found in the requested range, or if
65              iterated calls have reached the end of the requested range.
66
67       bmv_iflags
68              For the XFS_IOC_GETBMAPX function, this is a bitmask  containing
69              a combination of the following flags:
70
71           BMV_IF_ATTRFORK
72                  Return information about the extended attribute fork.
73
74           BMV_IF_PREALLOC
75                  Return information about unwritten pre-allocated segments.
76
77           BMV_IF_DELALLOC
78                  Return information about delayed allocation reservation seg‐
79                  ments.
80
81           BMV_IF_NO_HOLES
82                  Do not return information about holes.
83
84       The other bmv_* fields in the header are ignored.
85
86       On successful return from a call, the offset and length values  in  the
87       header  are  updated  so  that the command can be reused to obtain more
88       information.  The remaining elements of the array will be filled out by
89       the call as follows:
90
91       bmv_offset
92              File offset of segment.
93
94       bmv_block
95              Physical  starting  block  of  segment.  If this is -1, then the
96              segment is a hole.
97
98       bmv_length
99              Length of segment.
100
101       bmv_oflags
102              The XFS_IOC_GETBMAPX function will fill this field with a combi‐
103              nation of the following flags:
104
105           BMV_OF_PREALLOC
106                  The segment is an unwritten pre-allocation.
107
108           BMV_OF_DELALLOC
109                  The segment is a delayed allocation reservation.
110
111           BMV_OF_LAST
112                  This segment is the last in the file.
113
114           BMV_OF_SHARED
115                  This segment shares blocks with other files.
116
117       The other bmv_* fields are unused in the array of output records.
118
119       The  XFS_IOC_GETBMAPA  command  is  identical to XFS_IOC_GETBMAP except
120       that information about the attribute fork of the file is returned.
121

RETURN VALUE

123       On error, -1 is returned, and errno is set to indicate the error.
124

ERRORS

126       Error codes can be one of, but are not limited to, the following:
127
128       EFAULT The kernel was not able to copy into the userspace buffer.
129
130       EFSBADCRC
131              Metadata checksum validation failed while performing the query.
132
133       EFSCORRUPTED
134              Metadata corruption was encountered while performing the query.
135
136       EINVAL One of the arguments was not valid.
137
138       EIO    An I/O error was encountered while performing the query.
139
140       ENOMEM There was insufficient memory to perform the query.
141

CONFORMING TO

143       This API is specific to XFS filesystem on the Linux kernel.
144

SEE ALSO

146       ioctl(2)
147
148
149
150XFS                               2019-06-17             IOCTL-XFS-GETBMAPX(2)
Impressum