From 9faf87d0dde3bac074093ebd7ca4956297fef3ad Mon Sep 17 00:00:00 2001 From: alex Date: Tue, 20 Oct 2009 11:31:24 +0000 Subject: [PATCH] - declare write to lovobjids file --- lustre/mdd/mdd_trans.c | 4 +--- lustre/mds/mds_lov.c | 30 ++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/lustre/mdd/mdd_trans.c b/lustre/mdd/mdd_trans.c index f94d0de1..82cd1eb 100644 --- a/lustre/mdd/mdd_trans.c +++ b/lustre/mdd/mdd_trans.c @@ -80,9 +80,7 @@ int mdd_txn_start_cb(const struct lu_env *env, struct thandle *txn, (1 << shift) - 1) >> shift) + 1; /* add lov objids credits */ - /*LBUG(); - rc = fsfilt_write_record(obd, mds->mds_lov_objid_filp, data, - size, &off, 0);*/ + mds_declare_lov_write_objids(env, obd, txn); return 0; } diff --git a/lustre/mds/mds_lov.c b/lustre/mds/mds_lov.c index 6d3de44..5a777ca 100644 --- a/lustre/mds/mds_lov.c +++ b/lustre/mds/mds_lov.c @@ -537,6 +537,36 @@ out2: RETURN(rc); } +int mds_declare_lov_write_objids(const struct lu_env *env, + struct obd_device *obd, + struct thandle *th) +{ + struct mds_obd *mds = &obd->u.mds; + struct dt_object *o; + int len, rc = 0; + ENTRY; + + if (mds->mds_next_dev == NULL) + RETURN(0); + + o = mds->mds_lov_objid_dt; + if (o == NULL) + RETURN(0); + + /* we don't know what specific data we'll be writing + * so let's declare full file to be updated -- not optimal */ + + /* XXX: if new OST gets connected after this declaration + * the thread will be able to write out of declared window + * if we remove batching the problem disappears */ + + len = (mds->mds_lov_objid_lastidx + 1) * sizeof(obd_id); + rc = dt_declare_record_write(env, o, len, 0, th); + + RETURN(rc); +} +EXPORT_SYMBOL(mds_declare_lov_write_objids); + int mds_lov_write_objids(const struct lu_env *env, struct obd_device *obd, struct thandle *th) -- 1.8.3.1