X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Fptlrpc%2Ftarget.c;h=6f8bccf78da3bf54f875f98e70da130d3612033f;hb=18d78c77953017e5a76cd10bc74a0d078217a626;hp=0de17bfad2cbc25df2d837fcd5b09012cd29f01d;hpb=2a50b6bf048517aa1f63c4e29c3637f09c148fdb;p=fs%2Flustre-release.git diff --git a/lustre/ptlrpc/target.c b/lustre/ptlrpc/target.c index 0de17bf..6f8bccf 100644 --- a/lustre/ptlrpc/target.c +++ b/lustre/ptlrpc/target.c @@ -28,6 +28,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 +151,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(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 +247,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;