Whamcloud - gitweb
LU-1347 build: remove the vim/emacs modelines
[fs/lustre-release.git] / lustre / ptlrpc / target.c
index 0de17bf..f6944d5 100644 (file)
@@ -1,6 +1,4 @@
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
+/*
  * GPL HEADER START
  *
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -28,6 +26,8 @@
 /*
  * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
+ *
+ * Copyright (c) 2011, 2012, Whamcloud, Inc.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -149,19 +149,25 @@ static int lut_last_rcvd_write(const struct lu_env *env, struct lu_target *lut,
                                const struct lu_buf *buf, loff_t *off, int sync)
 {
         struct thandle *th;
-        struct txn_param p;
-        int rc, credits;
+        int rc;
         ENTRY;
 
-        credits = lut->lut_bottom->dd_ops->dt_credit_get(env, lut->lut_bottom,
-                                                         DTO_WRITE_BLOCK);
-        txn_param_init(&p, credits);
-
-        th = dt_trans_start(env, lut->lut_bottom, &p);
+        th = dt_trans_create(env, lut->lut_bottom);
         if (IS_ERR(th))
                 RETURN(PTR_ERR(th));
 
+        rc = dt_declare_record_write(env, lut->lut_last_rcvd,
+                                     buf->lb_len, *off, th);
+        if (rc)
+                goto stop;
+
+        rc = dt_trans_start_local(env, lut->lut_bottom, th);
+        if (rc)
+                goto stop;
+
         rc = dt_record_write(env, lut->lut_last_rcvd, buf, off, th);
+
+stop:
         dt_trans_stop(env, lut->lut_bottom, th);
 
         CDEBUG(D_INFO, "write last_rcvd header rc = %d:\n"
@@ -239,8 +245,8 @@ int lut_client_data_update(const struct lu_env *env, struct obd_export *exp)
 /**
  * Update server data in last_rcvd
  */
-static int lut_server_data_update(const struct lu_env *env,
-                                  struct lu_target *lut, int sync)
+int lut_server_data_update(const struct lu_env *env,
+                           struct lu_target *lut, int sync)
 {
         struct lr_server_data tmp_lsd;
         loff_t tmp_off = 0;
@@ -296,7 +302,7 @@ void lut_boot_epoch_update(struct lu_target *lut)
         if (lut->lut_bottom == NULL)
                 return obt_boot_epoch_update(lut);
 
-        rc = lu_env_init(&env, LCT_DT_THREAD);
+        rc = lu_env_init(&env, LCT_LOCAL);
         if (rc) {
                 CERROR("Can't initialize environment rc=%d\n", rc);
                 return;