dt_write_lock(env, parent, 0);
- rc = dt_lookup(env, parent, (struct dt_rec *)&tfid,
+ rc = dt_lookup(env, dt_object_child(parent), (struct dt_rec *)&tfid,
(const struct dt_key *)name);
/* Someone has removed the bad name entry by race. */
if (rc == -ENOENT)
};
/**
+ * Implementation of dt_index_operations::dio_lookup
+ *
+ * Used with striped directories.
+ *
+ * \see dt_index_operations::dio_lookup() in the API description for details.
+ */
+static int lod_striped_lookup(const struct lu_env *env, struct dt_object *dt,
+ struct dt_rec *rec, const struct dt_key *key)
+{
+ struct lod_object *lo = lod_dt_obj(dt);
+ struct dt_object *next;
+ const char *name = (const char *)key;
+
+ LASSERT(lo->ldo_dir_stripe_count > 0);
+
+ if (strcmp(name, dot) == 0) {
+ struct lu_fid *fid = (struct lu_fid *)rec;
+
+ *fid = *lod_object_fid(lo);
+ return 1;
+ }
+
+ if (strcmp(name, dotdot) == 0) {
+ next = dt_object_child(dt);
+ } else {
+ int index;
+
+ index = __lmv_name_to_stripe_index(lo->ldo_dir_hash_type,
+ lo->ldo_dir_stripe_count,
+ lo->ldo_dir_migrate_hash,
+ lo->ldo_dir_migrate_offset,
+ name, strlen(name), true);
+ if (index < 0)
+ return index;
+
+ next = lo->ldo_stripe[index];
+ if (!next || !dt_object_exists(next))
+ return -ENODEV;
+ }
+
+ return next->do_index_ops->dio_lookup(env, next, rec, key);
+}
+
+/**
* Implementation of dt_it_ops::init.
*
* Used with striped objects. Internally just initializes the iterator
}
static struct dt_index_operations lod_striped_index_ops = {
- .dio_lookup = lod_lookup,
+ .dio_lookup = lod_striped_lookup,
.dio_declare_insert = lod_declare_insert,
.dio_insert = lod_insert,
.dio_declare_delete = lod_declare_delete,
}
run_test 247e "mount .. as fileset"
+test_247f() {
+ [ $MDSCOUNT -lt 2 ] && skip_env "needs >= 2 MDTs"
+ [ $MDS1_VERSION -lt $(version_code 2.13.52) ] &&
+ skip "Need at least version 2.13.52"
+ lctl get_param -n mdc.$FSNAME-MDT0000*.import |
+ grep -q subtree ||
+ skip "Fileset feature is not supported"
+
+ mkdir $DIR/$tdir || error "mkdir $tdir failed"
+ $LFS mkdir -i $((MDSCOUNT - 1)) $DIR/$tdir/remote ||
+ error "mkdir remote failed"
+ mkdir $DIR/$tdir/remote/subdir || error "mkdir remote/subdir failed"
+ $LFS mkdir -c $MDSCOUNT $DIR/$tdir/striped ||
+ error "mkdir striped failed"
+ mkdir $DIR/$tdir/striped/subdir || error "mkdir striped/subdir failed"
+
+ local submount=${MOUNT}_$tdir
+
+ mkdir -p $submount || error "mkdir $submount failed"
+
+ local dir
+ local fileset=$FILESET
+
+ for dir in $tdir/remote $tdir/remote/subdir \
+ $tdir/striped $tdir/striped/subdir $tdir/striped/. ; do
+ FILESET="$fileset/$dir" mount_client $submount ||
+ error "mount $dir failed"
+ umount_client $submount
+ done
+}
+run_test 247f "mount striped or remote directory as fileset"
+
test_248a() {
local fast_read_sav=$($LCTL get_param -n llite.*.fast_read 2>/dev/null)
[ -z "$fast_read_sav" ] && skip "no fast read support"