+ } else if (lli->lli_sa_pattern & LSA_PATTERN_FN_SHARED) {
+ /* For mdtest shared dir stat() workload */
+ LASSERT(lli->lli_sa_pattern & LSA_PATTERN_FNAME);
+ ctx = ll_sax_get(dir);
+ if (ctx == NULL) {
+ ctx = ll_sax_alloc(dir);
+ if (ctx == NULL)
+ GOTO(out, rc = -ENOMEM);
+
+ spin_lock(&lli->lli_sa_lock);
+ if (lli->lli_sax) {
+ struct ll_statahead_context *tmp = ctx;
+
+ if (lli->lli_sa_pattern &
+ LSA_PATTERN_FN_SHARED) {
+ ctx = lli->lli_sax;
+ __ll_sax_get(ctx);
+ rc = ll_sax_add_sai(ctx, sai);
+ } else {
+ CWARN("%s: invalid pattern %#X.\n",
+ sbi->ll_fsname,
+ lli->lli_sa_pattern);
+ rc = -EINVAL;
+ }
+
+ spin_unlock(&lli->lli_sa_lock);
+ ll_sax_free(tmp);
+ if (rc)
+ GOTO(out, rc);
+ } else {
+ lli->lli_sax = ctx;
+ rc = ll_sax_add_sai(ctx, sai);
+ spin_unlock(&lli->lli_sa_lock);
+ }
+ } else {
+ spin_lock(&lli->lli_sa_lock);
+ if (!(lli->lli_sa_pattern & LSA_PATTERN_FN_SHARED)) {
+ spin_unlock(&lli->lli_sa_lock);
+ GOTO(out, rc = -EINVAL);
+ }
+
+ rc = ll_sax_add_sai(ctx, sai);
+ spin_unlock(&lli->lli_sa_lock);
+ }
+
+ if (rc)
+ GOTO(out, rc);
+ } else {
+ CERROR("%s: unsupported statahead pattern %#X.\n",
+ sbi->ll_fsname, lli->lli_sa_pattern);
+ GOTO(out, rc = -EOPNOTSUPP);