Whamcloud - gitweb
LU-1399 config: check lustre_cfg_new() return
[fs/lustre-release.git] / lustre / ofd / ofd_dev.c
index 698fd7f..82bcafc 100644 (file)
@@ -231,10 +231,8 @@ static void ofd_stack_fini(const struct lu_env *env, struct ofd_device *m,
                strcat(flags, "A");
        lustre_cfg_bufs_set_string(&bufs, 1, flags);
        lcfg = lustre_cfg_new(LCFG_CLEANUP, &bufs);
-       if (!lcfg) {
-               CERROR("Cannot alloc lcfg!\n");
+       if (lcfg == NULL)
                RETURN_EXIT;
-       }
 
        LASSERT(top);
        top->ld_ops->ldo_process_config(env, top, lcfg);
@@ -465,7 +463,7 @@ static int ofd_object_print(const struct lu_env *env, void *cookie,
        return (*p)(env, cookie, LUSTRE_OST_NAME"-object@%p", o);
 }
 
-struct lu_object_operations ofd_obj_ops = {
+static struct lu_object_operations ofd_obj_ops = {
        .loo_object_init        = ofd_object_init,
        .loo_object_free        = ofd_object_free,
        .loo_object_print       = ofd_object_print
@@ -895,7 +893,7 @@ out_free:
  * \retval             0 if successful
  * \retval             negative value on error
  */
-int ofd_set_info_hdl(struct tgt_session_info *tsi)
+static int ofd_set_info_hdl(struct tgt_session_info *tsi)
 {
        struct ptlrpc_request   *req = tgt_ses_req(tsi);
        struct ost_body         *body = NULL, *repbody;
@@ -1137,7 +1135,7 @@ unlock_zero_regions(struct ldlm_namespace *ns, struct list_head *locked)
  * \retval             0 if successful
  * \retval             negative value on error
  */
-int ofd_get_info_hdl(struct tgt_session_info *tsi)
+static int ofd_get_info_hdl(struct tgt_session_info *tsi)
 {
        struct obd_export               *exp = tsi->tsi_exp;
        struct ofd_device               *ofd = ofd_exp(exp);
@@ -1636,7 +1634,8 @@ static int ofd_create_hdl(struct tgt_session_info *tsi)
                CDEBUG(D_HA, "ofd_last_id() = "LPU64" -> diff = %d\n",
                        ofd_seq_last_oid(oseq), diff);
                if (-diff > OST_MAX_PRECREATE) {
-                       /* FIXME: should reset precreate_next_id on MDS */
+                       /* Let MDS know that we are so far ahead. */
+                       ostid_set_id(&rep_oa->o_oi, ofd_seq_last_oid(oseq) + 1);
                        rc = 0;
                } else if (diff < 0) {
                        rc = ofd_orphans_destroy(tsi->tsi_env, exp,
@@ -2503,13 +2502,13 @@ static void ofd_punch_hpreq_fini(struct ptlrpc_request *req)
        ofd_punch_hpreq_check(req);
 }
 
-struct ptlrpc_hpreq_ops ofd_hpreq_rw = {
+static struct ptlrpc_hpreq_ops ofd_hpreq_rw = {
        .hpreq_lock_match       = ofd_rw_hpreq_lock_match,
        .hpreq_check            = ofd_rw_hpreq_check,
        .hpreq_fini             = ofd_rw_hpreq_fini
 };
 
-struct ptlrpc_hpreq_ops ofd_hpreq_punch = {
+static struct ptlrpc_hpreq_ops ofd_hpreq_punch = {
        .hpreq_lock_match       = ofd_punch_hpreq_lock_match,
        .hpreq_check            = ofd_punch_hpreq_check,
        .hpreq_fini             = ofd_punch_hpreq_fini
@@ -3016,7 +3015,7 @@ static struct lu_device_type ofd_device_type = {
  * \retval             0 if successful
  * \retval             negative value on error
  */
-int __init ofd_init(void)
+static int __init ofd_init(void)
 {
        int                             rc;
 
@@ -3041,7 +3040,7 @@ int __init ofd_init(void)
  * This function is called upon OFD module unloading.
  * It frees all related structures and unregisters OFD device type.
  */
-void __exit ofd_exit(void)
+static void __exit ofd_exit(void)
 {
        ofd_fmd_exit();
        lu_kmem_fini(ofd_caches);