.br
The \fIsetstripe_options\fR specify the specific layout for the mirror. It can
be a plain layout with specific striping pattern or a composite layout like
-Progressive File Layout (PFL) (see \fBlfs-setstripe\fR(1)).
+Progressive File Layout (PFL), including specifying compression component
+(see \fBlfs-setstripe\fR(1)).
If \fIsetstripe_options\fR are not specified,
then the stripe options inherited from the previous component will be used.
If \fIvictim_file\fR exists, then the
.TP
.I setstripe_options
The layout of one mirror. The options are the same as those for
-\fBlfs-setstripe\fR(1) command.
+\fBlfs-setstripe\fR(1) command, including options for setting compression
+component.
If \fIsetstripe_options\fR are not specified, then the stripe options inherited
from the previous component will be used. This option cannot be specified with
\fB\-f\fR <\fIvictim_file\fR> option.
}
run_test 100k "create with DoM compression component"
+test_100l() {
+ (( $MDS1_VERSION >= $(version_code 2.14.0.91) )) ||
+ skip "Need MDS >= 2.14.0.91 for compression support"
+
+ local tf=$DIR/$tdir/$tfile
+ local tf2=$DIR/$tdir/${tfile}_compr
+ local flags
+ local p="$TMP/$TESTSUITE-$TESTNAME.parameters"
+
+ save_lustre_params client "llite.*.enable_compression" > $p
+ stack_trap "rm -rf $DIR/$tdir; restore_lustre_params < $p" EXIT
+ $LCTL set_param llite.*.enable_compression=1
+
+ test_mkdir $DIR/$tdir
+
+ $LFS setstripe -E eof -c -1 -Z none $tf || error "setstripe $tf failed"
+ cp /etc/hosts $tf || error "error writing file $tf"
+ $LFS migrate $tf || {
+ $LFS getstripe $tf
+ error "cannot migrate $tf"
+ }
+ $LFS getstripe $tf
+
+ $LFS setstripe -E eof -c -1 -Z gzip:4 $tf2 ||
+ error "setstripe compressed file $tf2 failed"
+ cp /etc/hosts $tf2 || error "error writing file $tf2"
+ $LFS migrate $tf2|| {
+ $LFS getstripe $tf2
+ error "cannot migrate $tf2"
+ }
+ $LFS getstripe $tf2
+}
+run_test 100l "lfs migrate compressed file"
export LFS_SETSTRIPE_COMPR_OK=""
complete_test $SECONDS
goto comp_add;
}
- if (v1->lmm_pattern == LOV_PATTERN_RAID0)
- comp->llc_pattern = LLAPI_LAYOUT_RAID0;
- else if (v1->lmm_pattern == (LOV_PATTERN_RAID0 |
- LOV_PATTERN_OVERSTRIPING))
- comp->llc_pattern = LLAPI_LAYOUT_OVERSTRIPING;
- else if (v1->lmm_pattern & LOV_PATTERN_MDT)
- comp->llc_pattern = LLAPI_LAYOUT_MDT;
- else
- /* Lustre only supports RAID0, overstripping,
- * DoM and FOREIGN/HSM for now.
- */
- comp->llc_pattern = v1->lmm_pattern;
+ comp->llc_pattern = llapi_pattern_from_lov(v1->lmm_pattern);
if (v1->lmm_stripe_size == 0)
comp->llc_stripe_size = LLAPI_LAYOUT_DEFAULT;
return lov_pattern;
}
+uint64_t llapi_pattern_from_lov(__u32 lov_pattern)
+{
+ uint64_t pattern;
+
+ switch (lov_pattern) {
+ case LOV_PATTERN_RAID0:
+ pattern = LLAPI_LAYOUT_RAID0;
+ break;
+ case LOV_PATTERN_MDT:
+ pattern = LLAPI_LAYOUT_MDT;
+ break;
+ case LOV_PATTERN_FOREIGN:
+ pattern = LLAPI_LAYOUT_FOREIGN;
+ break;
+ case LOV_PATTERN_OVERSTRIPING | LOV_PATTERN_RAID0:
+ pattern = LLAPI_LAYOUT_OVERSTRIPING;
+ break;
+ case LOV_PATTERN_RAID0 | LOV_PATTERN_COMPRESS:
+ pattern = LLAPI_LAYOUT_RAID0 | LLAPI_LAYOUT_COMPRESS;
+ break;
+ case LOV_PATTERN_MDT | LOV_PATTERN_COMPRESS:
+ pattern = LLAPI_LAYOUT_MDT | LLAPI_LAYOUT_COMPRESS;
+ break;
+ default:
+ pattern = lov_pattern;
+ }
+
+ return pattern;
+}
+
/**
* Convert the data from a llapi_layout to a newly allocated lov_user_md.
* The caller is responsible for freeing the returned pointer.
if (path == NULL ||
(layout != NULL && layout->llot_magic != LLAPI_LAYOUT_MAGIC)) {
+ if (path == NULL)
+ fprintf(stderr, "Empty file name\n");
+ else
+ fprintf(stderr, "Invalid layout magic %x\n",
+ layout->llot_magic);
errno = EINVAL;
return -1;
}
fd = open(path, open_flags, mode);
- if (layout == NULL || fd < 0)
+ if (layout == NULL || fd < 0) {
+ if (fd < 0)
+ fprintf(stderr, "Cannot open file %s: %d\n", path, fd);
return fd;
+ }
lum = llapi_layout_to_lum(layout);
tmp = errno;
close(fd);
errno = tmp;
+ fprintf(stderr, "Invalid layout: %s\n", strerror(errno));
return -1;
}
tmp = errno;
close(fd);
errno = tmp;
+ fprintf(stderr, "Cannot set layout EA: %s\n", strerror(errno));
fd = -1;
}