- struct lu_seq_range *space = &seq->lss_space;
- int rc = 0;
-
- ENTRY;
-
- LASSERT(range_is_sane(space));
-
- /* Check if available space ends and allocate new super seq */
- if (range_is_exhausted(space)) {
- if (!seq->lss_cli) {
- CERROR("%s: No sequence controller is attached.\n",
- seq->lss_name);
- RETURN(-ENODEV);
- }
-
- rc = seq_client_alloc_super(seq->lss_cli, env);
- if (rc) {
- CERROR("%s: Can't allocate super-sequence, rc %d\n",
- seq->lss_name, rc);
- RETURN(rc);
- }
-
- /* Saving new range to allocation space. */
- *space = seq->lss_cli->lcs_space;
- LASSERT(range_is_sane(space));
- }
-
- rc = range_alloc_set(env, out, seq);
- if (rc == 0) {
- CDEBUG(D_INFO, "%s: Allocated meta-sequence "
- DRANGE"\n", seq->lss_name, PRANGE(out));
- }
-
- RETURN(rc);
+ struct lu_seq_range *space = &seq->lss_space;
+ int rc = 0;
+
+ ENTRY;
+
+ LASSERT(range_is_sane(space));
+
+ /* Check if available space ends and allocate new super seq */
+ if (range_is_exhausted(space)) {
+ if (!seq->lss_cli) {
+ CERROR("%s: No sequence controller is attached.\n",
+ seq->lss_name);
+ RETURN(-ENODEV);
+ }
+
+ rc = seq_client_alloc_super(seq->lss_cli, env);
+ if (rc) {
+ CERROR("%s: Can't allocate super-sequence, rc %d\n",
+ seq->lss_name, rc);
+ RETURN(rc);
+ }
+
+ /* Saving new range to allocation space. */
+ *space = seq->lss_cli->lcs_space;
+ LASSERT(range_is_sane(space));
+ if (seq->lss_cli->lcs_srv == NULL) {
+ struct lu_server_fld *fld;
+
+ /* Insert it to the local FLDB */
+ fld = seq->lss_site->ss_server_fld;
+ mutex_lock(&fld->lsf_lock);
+ rc = fld_insert_entry(env, fld, space);
+ mutex_unlock(&fld->lsf_lock);
+ }
+ }
+
+ rc = range_alloc_set(env, out, seq);
+ if (rc != 0) {
+ CERROR("%s: Allocated meta-sequence failed: rc = %d\n",
+ seq->lss_name, rc);
+ RETURN(rc);
+ }
+
+ CDEBUG(D_INFO, "%s: Allocated meta-sequence " DRANGE"\n",
+ seq->lss_name, PRANGE(out));
+
+ RETURN(rc);