Whamcloud - gitweb
LU-921 llite: warning in case of discarding dirty pages
[fs/lustre-release.git] / lustre / ofd / ofd_obd.c
index 1f8e917..e024671 100644 (file)
@@ -44,7 +44,7 @@
 
 #include "ofd_internal.h"
 #include <obd_cksum.h>
-#include <lquota.h>
+#include <lustre_quota.h>
 
 static int ofd_export_stats_init(struct ofd_device *ofd,
                                 struct obd_export *exp, void *client_nid)
@@ -177,7 +177,7 @@ static int ofd_parse_connect_data(const struct lu_env *env,
                        lsd->lsd_feature_compat |= OBD_COMPAT_OST;
                        /* sync is not needed here as lut_client_add will
                         * set exp_need_sync flag */
-                       lut_server_data_update(env, &ofd->ofd_lut, 0);
+                       tgt_server_data_update(env, &ofd->ofd_lut, 0);
                } else if (index != data->ocd_index) {
                        LCONSOLE_ERROR_MSG(0x136, "Connection from %s to index"
                                           " %u doesn't match actual OST index"
@@ -307,7 +307,7 @@ static int ofd_obd_connect(const struct lu_env *env, struct obd_export **_exp,
 
                memcpy(ted->ted_lcd->lcd_uuid, cluuid,
                       sizeof(ted->ted_lcd->lcd_uuid));
-               rc = lut_client_new(env, exp);
+               rc = tgt_client_new(env, exp);
                if (rc != 0)
                        GOTO(out, rc);
                ofd_export_stats_init(ofd, exp, localdata);
@@ -355,7 +355,7 @@ static int ofd_obd_disconnect(struct obd_export *exp)
        /* Do not erase record for recoverable client. */
        if (exp->exp_obd->obd_replayable &&
            (!exp->exp_obd->obd_fail || exp->exp_failed))
-               lut_client_del(&env, exp);
+               tgt_client_del(&env, exp);
        lu_env_fini(&env);
 
        class_export_put(exp);
@@ -377,7 +377,7 @@ static int ofd_init_export(struct obd_export *exp)
                                     &exp->exp_client_uuid)))
                return 0;
 
-       rc = lut_client_alloc(exp);
+       rc = tgt_client_alloc(exp);
        if (rc == 0)
                ldlm_init_export(exp);
        if (rc)
@@ -402,7 +402,7 @@ static int ofd_destroy_export(struct obd_export *exp)
                return 0;
 
        ldlm_destroy_export(exp);
-       lut_client_free(exp);
+       tgt_client_free(exp);
 
        ofd_fmd_cleanup(exp);
 
@@ -425,6 +425,14 @@ static int ofd_destroy_export(struct obd_export *exp)
        return 0;
 }
 
+int ofd_postrecov(const struct lu_env *env, struct ofd_device *ofd)
+{
+       struct lu_device *ldev = &ofd->ofd_dt_dev.dd_lu_dev;
+
+       CDEBUG(D_HA, "%s: recovery is over\n", ofd_obd(ofd)->obd_name);
+       return ldev->ld_ops->ldo_recovery_complete(env, ldev);
+}
+
 int ofd_obd_postrecov(struct obd_device *obd)
 {
        struct lu_env            env;
@@ -438,7 +446,8 @@ int ofd_obd_postrecov(struct obd_device *obd)
                RETURN(rc);
        ofd_info_init(&env, obd->obd_self_export);
 
-       rc = ldev->ld_ops->ldo_recovery_complete(&env, ldev);
+       rc = ofd_postrecov(&env, ofd_dev(ldev));
+
        lu_env_fini(&env);
        RETURN(rc);
 }
@@ -942,6 +951,10 @@ static int ofd_destroy_by_fid(const struct lu_env *env,
 
        ENTRY;
 
+       fo = ofd_object_find(env, ofd, fid);
+       if (IS_ERR(fo))
+               RETURN(PTR_ERR(fo));
+
        /* Tell the clients that the object is gone now and that they should
         * throw away any cached pages. */
        ofd_build_resid(fid, &info->fti_resid);
@@ -954,9 +967,6 @@ static int ofd_destroy_by_fid(const struct lu_env *env,
        if (rc == ELDLM_OK)
                ldlm_lock_decref(&lockh, LCK_PW);
 
-       fo = ofd_object_find(env, ofd, fid);
-       if (IS_ERR(fo))
-               RETURN(PTR_ERR(fo));
        LASSERT(fo != NULL);
 
        rc = ofd_object_destroy(env, fo, orphan);
@@ -1004,14 +1014,15 @@ int ofd_destroy(const struct lu_env *env, struct obd_export *exp,
                lrc = ofd_destroy_by_fid(env, ofd, &info->fti_fid, 0);
                if (lrc == -ENOENT) {
                        CDEBUG(D_INODE,
-                              "destroying non-existent object "LPU64"\n",
-                              oa->o_id);
+                              "%s: destroying non-existent object "DFID"\n",
+                              ofd_obd(ofd)->obd_name, PFID(&info->fti_fid));
                        /* rewrite rc with -ENOENT only if it is 0 */
                        if (rc == 0)
                                rc = lrc;
                } else if (lrc != 0) {
-                       CEMERG("error destroying object "LPU64": %d\n",
-                              oa->o_id, rc);
+                       CERROR("%s: error destroying object "DFID": %d\n",
+                              ofd_obd(ofd)->obd_name, PFID(&info->fti_fid),
+                              rc);
                        rc = lrc;
                }
                count--;
@@ -1307,15 +1318,14 @@ static int ofd_sync(const struct lu_env *env, struct obd_export *exp,
                GOTO(out, rc = PTR_ERR(fo));
        }
 
-       ofd_write_lock(env, fo);
        if (!ofd_object_exists(fo))
-               GOTO(unlock, rc = -ENOENT);
+               GOTO(put, rc = -ENOENT);
 
        if (dt_version_get(env, ofd_object_child(fo)) >
            ofd_obd(ofd)->obd_last_committed) {
                rc = dt_object_sync(env, ofd_object_child(fo));
                if (rc)
-                       GOTO(unlock, rc);
+                       GOTO(put, rc);
        }
 
        oinfo->oi_oa->o_valid = OBD_MD_FLID;
@@ -1324,8 +1334,7 @@ static int ofd_sync(const struct lu_env *env, struct obd_export *exp,
 
        ofd_counter_incr(exp, LPROC_OFD_STATS_SYNC, oinfo->oi_jobid, 1);
        EXIT;
-unlock:
-       ofd_write_unlock(env, fo);
+put:
        ofd_object_put(env, fo);
 out:
        return rc;