file FID
.IP %{mirror-count},%LN
FLR mirror count
+.IP %{pool},%Lp
+OST pool name of last instantiated component
.IP %{projid},%LP
numerical project ID
.IP %{stripe-size},%LS
case 'N':
LF3_EMIT_N('d', "(lov-mirror-count)");
break;
+ case 'p':
+ LF3_EMIT_S('a', "(lov-pool)");
+ break;
case 'P':
LF3_EMIT_N('d', "(projid)");
break;
LF3_EMIT_S('a', "(file-fid)");
else if (strcmp(ext, "mirror-count") == 0)
LF3_EMIT_N('d', "(lov-mirror-count)", ext);
+ else if (strcmp(ext, "pool") == 0)
+ LF3_EMIT_S('a', "(lov-pool)", ext);
+ else if (strcmp(ext, "pools") == 0)
+ LF3_EMIT_S('a', "(lov-pools)", ext);
else if (strcmp(ext, "projid") == 0)
LF3_EMIT_N('d', "(projid)", ext);
else if (strcmp(ext, "stripe-count") == 0)
(flags) inode flags (I)
(nlink) inode link count (I)
(mode) inode type and access mode flags (I,C)
- (size) ... (I)
- (blocks) ... (I)
+ (size) file size in bytes (I)
+ (blocks) file allocated blocks in 512-byte sectors (I)
(self-fid) self_fid from lma xattr of inode (F)
(file-fid) self_fid for MDT inode, FID of corresponding file for OST object (ff_parent)
(links) list of pairs of parent-fid, name (list (cons F, S) ...)
(relative-paths) list of all paths to file relative to client mount (list S ...)
(xattr-ref name) xattr value as bytevector
(xattrs) list of name, xattr value pairs
+ (pool) name of last initialized pool (S)
(pools) list of pool names (list S ...)
As much as possible, attribute values are evaluated on demand and
return scm_from_uint64(stripe_size);
}
+SCM_DEFINE(ls3_scm_lov_pool, "lov-pool", 0, 0, 0,
+ (), "return pool of last component of current file")
+{
+ struct ls3_object_attrs *loa = ls3_attrs_try(LS3_OBJECT_ATTR_LOV);
+ struct llapi_layout *ll = NULL;
+ char buf[LOV_MAXPOOLNAME + 1];
+ SCM lis = SCM_EOL;
+ uint32_t flags;
+ int rc;
+
+ /* TODO Distinguish between missing xattr and other error. */
+ if (loa->loa_layout == NULL)
+ return SCM_EOL;
+
+ ll = loa->loa_layout;
+
+ /* XXX llapi_layout_*() functions return -1 on error and set errno. */
+ rc = llapi_layout_comp_use(ll, LLAPI_LAYOUT_COMP_USE_LAST);
+ if (rc < 0)
+ goto out;
+
+ buf[0] = '\0';
+
+ rc = llapi_layout_comp_flags_get(ll, &flags);
+ if (!(flags & LCME_FL_INIT)) {
+ rc = llapi_layout_comp_use(ll, LLAPI_LAYOUT_COMP_USE_PREV);
+ if (rc < 0)
+ goto out;
+ }
+
+ rc = llapi_layout_pool_name_get(ll, buf, sizeof(buf));
+ if (rc < 0)
+ goto out;
+
+ if (buf[0] != '\0')
+ lis = scm_from_latin1_string(buf);
+
+out:
+ if (rc < 0)
+ ls3_throw_read_attr_error(LS3_OBJECT_ATTR_LOV,
+ errno != 0 ? errno : EINVAL);
+
+ return lis;
+}
+
SCM_DEFINE(ls3_scm_lov_pools_list, "lov-pools", 0, 0, 0,
(), "return all pools from LOV of current file")
{
"lov-stripe-count",
"lov-stripe-size",
"lov-ost-indexes",
+ "lov-pool",
"lov-pools",
"print-json",
"print-file-fid",
file-fid
self-fid
links
+ lov-pool
lov-pools
lov-ost-indexes
xattrs
test_116() {
local file=$MOUNT/$tfile
declare -a fid
+ local mb=1
+ local first_pool=tst_pool
+ declare -A fid_s
+ local combined="($first_pool"
local x
init_lipe_find3_env
-name $tfile-4-$x -printf '%LS %{fid}'
done
+ # Test pool and pools options
+ $LFS setstripe -E "$mb"M -c 1 --pool "$first_pool" "$file-pfl-all" ||
+ error "cannot first setstripe pool $x for file $file-pfl-all"
+
+ for x in testpool newpool oldpool; do
+ $LFS setstripe -c 1 --pool "$x" "$file-5-$x" ||
+ error "cannot setstripe pool "$x" for file $file-5-$x"
+
+ fid_s[${x}]=$($LFS path2fid "$file-5-$x")
+ echo XXX > "$file-5-$x"
+
+ mb=$((mb + 10))
+ $LFS setstripe --comp-add -E "$mb"M -c 1 \
+ --pool $x "$file-pfl-all" ||
+ error "cannot setstripe pool $x for file $file-pfl-all"
+
+ echo XXX >> "$file-pfl-all"
+ done
+ pfid=$($LFS path2fid "$file-pfl-all")
+ sync
+
+ for x in testpool newpool oldpool; do
+ combined+=" $x"
+ expect1 "$x ${fid_s[${x}]}" lipe_find3_facet mds1 \
+ -name $tfile-5-$x -printf '%{pool} %{fid}'
+ expect1 "$x ${fid_s[${x}]}" lipe_find3_facet mds1 \
+ -name $tfile-5-$x -printf '%Lp %{fid}'
+ done
+ combined+=")"
+
+ expect1 "$combined $pfid" lipe_find3_facet mds1 \
+ -name $tfile-pfl-all -printf '%{pools} %{fid}'
+
+ expect1 "newpool $pfid" lipe_find3_facet mds1 \
+ -name $tfile-pfl-all -printf '%Lp %{fid}'
+
init_lipe_find3_env
}
run_test 116 "lipe_find3 verify printf formats"
done
for proc in absolute-paths relative-paths links lov-mirror-count \
- lov-ost-indexes lov-pools lov-stripe-count xattrs; do
+ lov-ost-indexes lov-pool lov-pools lov-stripe-count xattrs; do
expect_print lipe_scan3_format $facet "($proc)"
done
}
ost_indexes=($($LFS getstripe --yaml "$file" | yq '.lmm_objects[] |
.l_ost_idx'))
+ expect_expr "$facet" '(lov-pool)' '()'
expect_expr "$facet" '(lov-pools)' '()'
expect_expr "$facet" '(lov-ost-indexes)' "(${ost_indexes[*]})"
}