" G gid get grouplock\n"
" g gid put grouplock\n"
" H[num] create HSM released file with num stripes\n"
+" I fiemap\n"
" K link path to filename\n"
" L link\n"
" l symlink filename to path\n"
return rc;
}
+static int do_fiemap(int fd)
+{
+ struct fiemap *pf;
+ int extents;
+ int save_errno;
+ int i;
+
+ extents = 0;
+ for (i = 0; i < 2; i++) {
+ if ((pf = malloc(sizeof(struct fiemap) +
+ extents * sizeof(struct fiemap_extent))) == NULL) {
+ perror("malloc failed");
+ exit(1);
+ }
+ pf->fm_start = 0;
+ pf->fm_length = FIEMAP_MAX_OFFSET;
+ pf->fm_flags = FIEMAP_FLAG_SYNC;
+ pf->fm_extent_count = extents;
+
+ if (ioctl(fd, FS_IOC_FIEMAP, pf) < 0) {
+ save_errno = errno;
+ if (i == 0)
+ perror("probe fiemap failed");
+ else
+ perror("fiemap failed");
+ exit(save_errno);
+ }
+ extents = pf->fm_mapped_extents;
+ free(pf);
+ }
+ return 0;
+}
+
#define POP_ARG() (pop_arg(argc, argv))
int main(int argc, char **argv)
}
rc = fd;
break;
+ case 'I':
+ do_fiemap(fd);
+ break;
case 'j':
if (flock(fd, LOCK_EX) == -1)
errx(-1, "flock()");
}
run_test 44e "write and read maximal stripes"
+test_44f() {
+ [ "$FSTYPE" != "zfs" ] ||
+ skip "ORI-366/LU-1941: FIEMAP unimplemented on ZFS"
+
+ local i
+ # required space: NUMFILES_44f * 20Mb
+ local NUMFILES_44f=${NUMFILES_44f:-50}
+
+ for (( i=0; i<NUMFILES_44f; i++ )); do
+ multiop $DIR/$tfile-$i \
+ Ow10485760Z10485760w10485760Ic ||
+ error "multiop failed"
+ done
+}
+run_test 44f "Check fiemap for sparse files"
+
dirty_osc_total() {
tot=0
for d in `lctl get_param -n ${OSC}.*.cur_dirty_bytes`; do