The initial implementation of "lfs setstripe ... --comp-flags=prefer"
only allowed specifying a single "prefer" argument for a given
mirror component, which would set both the "LCME_FL_PREF_RD" and
"LCME_FL_PREF_WR" flags at the same time.
This patch adds the separated component flags "prefrd" and "prefwr"
to allow setting the individual flags on a component.
Lustre-change: https://review.whamcloud.com/52508
Lustre-commit: TBD (from
a4cd76c790c46b4bf6d85e386b1054d4b925e095)
Test-Parameters: trivial testlist=sanity-flr
Change-Id: I3e413cb37fab7ab2834946536705ce61a3feeed4
Signed-off-by: Jian Yu <yujian@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/52525
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Colin Faber <cfaber@ddn.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Replicated (mirrored) components that are preferred for read or write.
For example, because they are located on SSD-based OSTs, or are more
local on the network to clients.
+.TP
+.B prefrd
+Replicated (mirrored) components that are preferred for read.
+.TP
+.B prefwr
+Replicated (mirrored) components that are preferred for write.
.RE
.TP
.BR --component-start | --comp-start
For example, because they are located on SSD-based OSTs, or are more
local on the network to clients.
.TP
+.B prefrd
+Replicated (mirrored) components that are preferred for read.
+.TP
+.B prefwr
+Replicated (mirrored) components that are preferred for write.
+.TP
.B nosync
Replicated (mirrored) components that do not resync using \fB
lfs mirror resync\fR. Files with the \fBnosync\fR flag will also
.B * prefer\fR - component preferred for read/write in a mirrored file
.RE
.RS
+.B * prefrd\fR - component preferred for read in a mirrored file
+.RE
+.RS
+.B * prefwr\fR - component preferred for write in a mirrored file
+.RE
+.RS
.B * stale\fR - component has outdated data in a mirrored file. This flag is
not allowed to be set on a component of the last non-stale mirror.
Once a component is marked
{ LCME_FL_INIT, "init" },
{ LCME_FL_STALE, "stale" },
{ LCME_FL_PREF_RW, "prefer" },
+ { LCME_FL_PREF_RD, "prefrd" },
+ { LCME_FL_PREF_WR, "prefwr" },
{ LCME_FL_OFFLINE, "offline" },
{ LCME_FL_NOSYNC, "nosync" },
{ LCME_FL_EXTENSION, "extension" },
local td=$DIR/$tdir
local tf=$td/$tfile
+ local flag
local ids
local i
cp /etc/hosts $tf || error "error writing file '$tf'"
$LFS mirror resync $tf || error "error resync-ing file '$tf'"
- $LFS setstripe --comp-set -I 0x20003 --comp-flags=prefer $tf ||
- error "error setting flag prefer"
+ for flag in prefer prefrd prefwr; do
+ $LFS setstripe --comp-set -I 0x20003 --comp-flags=$flag $tf ||
+ error "error setting flag $flag"
- verify_comp_attr lcme_flags $tf 0x20003 prefer
+ verify_comp_attr lcme_flags $tf 0x20003 $flag
- $LFS setstripe --comp-set -I 0x20003 --comp-flags=^prefer $tf ||
- error "error clearing prefer flag from component 0x20003"
+ $LFS setstripe --comp-set -I 0x20003 --comp-flags=^$flag $tf ||
+ error "error clearing $flag flag from component 0x20003"
+ done
# MDS disallows setting stale flag on the last non-stale mirror
[[ $MDS1_VERSION -ge $(version_code 2.12.3.1) ]] || return 0
" [[!] --blocks|-b N] [[!] --component-count [+-]<comp_cnt>]\n"
" [[!] --component-start [+-]N[kMGTPE]]\n"
" [[!] --component-end|-E [+-]N[kMGTPE]]\n"
- " [[!] --component-flags {init,stale,prefer,offline,nosync,extension}]\n"
+ " [[!] --component-flags {init,stale,prefer,prefrd,prefwr,offline,nosync,extension}]\n"
" [[!] --compress|--compr|-Z <compr_type>[:[+-]<compr_level>]\n"
" [[!] --compress-type=<compress_type>\n"
" [[!] --compress-level=[+-]<compress_level>\n"
return;
}
for (i = 0; i < ARRAY_SIZE(comp_flags_table); i++) {
- if (comp_flags & comp_flags_table[i].cfn_flag) {
+ const char *cfn_name = comp_flags_table[i].cfn_name;
+ __u32 cfn_flag = comp_flags_table[i].cfn_flag;
+
+ if ((comp_flags & cfn_flag) == cfn_flag) {
if (found)
llapi_printf(LLAPI_MSG_NORMAL, ",");
- llapi_printf(LLAPI_MSG_NORMAL, "%s",
- comp_flags_table[i].cfn_name);
+ llapi_printf(LLAPI_MSG_NORMAL, "%s", cfn_name);
comp_flags &= ~comp_flags_table[i].cfn_flag;
found = true;
}