Whamcloud - gitweb
LU-7434 ptlrpc: lost bulk leads to a hang
[fs/lustre-release.git] / lustre / fid / fid_store.c
index eff79a4..9edd13c 100644 (file)
@@ -27,7 +27,7 @@
  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  *
- * Copyright (c) 2011, 2013, Intel Corporation.
+ * Copyright (c) 2011, 2014, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
 
 #define DEBUG_SUBSYSTEM S_FID
 
-#ifdef __KERNEL__
-# include <libcfs/libcfs.h>
-# include <linux/module.h>
-#else /* __KERNEL__ */
-# include <liblustre.h>
-#endif
-
-#include <obd.h>
-#include <obd_class.h>
+#include <libcfs/libcfs.h>
 #include <dt_object.h>
-#include <md_object.h>
 #include <obd_support.h>
-#include <lustre_req_layout.h>
 #include <lustre_fid.h>
+#include <lustre_fld.h>
 #include "fid_internal.h"
 
-#ifdef __KERNEL__
-
 static struct lu_buf *seq_store_buf(struct seq_thread_info *info)
 {
         struct lu_buf *buf;
@@ -103,9 +92,8 @@ int seq_update_cb_add(struct thandle *th, struct lu_server_seq *seq)
 
        dcb            = &ccb->suc_cb;
        dcb->dcb_func  = seq_update_cb;
-       CFS_INIT_LIST_HEAD(&dcb->dcb_linkage);
-       strncpy(dcb->dcb_name, "seq_update_cb", MAX_COMMIT_CB_STR_LEN);
-       dcb->dcb_name[MAX_COMMIT_CB_STR_LEN - 1] = '\0';
+       INIT_LIST_HEAD(&dcb->dcb_linkage);
+       strlcpy(dcb->dcb_name, "seq_update_cb", sizeof(dcb->dcb_name));
 
        rc = dt_trans_cb_add(th, dcb);
        if (rc)
@@ -130,14 +118,17 @@ int seq_store_update(const struct lu_env *env, struct lu_server_seq *seq,
        if (IS_ERR(th))
                RETURN(PTR_ERR(th));
 
+       /* Store ranges in le format. */
+       range_cpu_to_le(&info->sti_space, &seq->lss_space);
+
        rc = dt_declare_record_write(env, seq->lss_obj,
-                                    sizeof(struct lu_seq_range), 0, th);
+                                    seq_store_buf(info), 0, th);
        if (rc)
                GOTO(exit, rc);
 
        if (out != NULL) {
                rc = fld_declare_server_create(env,
-                                              seq->lss_site->ms_server_fld,
+                                              seq->lss_site->ss_server_fld,
                                               out, th);
                if (rc)
                        GOTO(exit, rc);
@@ -147,16 +138,13 @@ int seq_store_update(const struct lu_env *env, struct lu_server_seq *seq,
        if (rc)
                GOTO(exit, rc);
 
-       /* Store ranges in le format. */
-       range_cpu_to_le(&info->sti_space, &seq->lss_space);
-
        rc = dt_record_write(env, seq->lss_obj, seq_store_buf(info), &pos, th);
        if (rc) {
                CERROR("%s: Can't write space data, rc %d\n",
                       seq->lss_name, rc);
                GOTO(exit, rc);
        } else if (out != NULL) {
-               rc = fld_server_create(env, seq->lss_site->ms_server_fld, out,
+               rc = fld_server_create(env, seq->lss_site->ss_server_fld, out,
                                       th);
                if (rc) {
                        CERROR("%s: Can't Update fld database, rc %d\n",
@@ -191,9 +179,7 @@ int seq_store_read(struct lu_server_seq *seq,
         info = lu_context_key_get(&env->le_ctx, &seq_thread_key);
         LASSERT(info != NULL);
 
-       rc = seq->lss_obj->do_body_ops->dbo_read(env, seq->lss_obj,
-                                                seq_store_buf(info),
-                                                &pos, BYPASS_CAPA);
+       rc = dt_read(env, seq->lss_obj, seq_store_buf(info), &pos);
 
         if (rc == sizeof(info->sti_space)) {
                 range_le_to_cpu(&seq->lss_space, &info->sti_space);
@@ -262,4 +248,3 @@ void seq_store_fini(struct lu_server_seq *seq,
 
         EXIT;
 }
-#endif