From d22222efddb2e2611b72d1e695e91bfd7215bf6d Mon Sep 17 00:00:00 2001 From: Vladimir Saveliev Date: Fri, 20 Aug 2010 19:03:09 +0400 Subject: [PATCH] b=17485 Don't reset the lov_objid to last_id sent by OST https://bugzilla.lustre.org/attachment.cgi?id=30559 for head i=Hongchao.zhang i=andrew.perepechko --- lustre/mds/mds_lov.c | 10 +--------- lustre/obdfilter/filter.c | 9 ++++++++- lustre/osc/osc_create.c | 5 +++++ 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/lustre/mds/mds_lov.c b/lustre/mds/mds_lov.c index a44652a..0bf8a72 100644 --- a/lustre/mds/mds_lov.c +++ b/lustre/mds/mds_lov.c @@ -482,7 +482,6 @@ static int mds_lov_get_objid(struct obd_device * obd, unsigned int page; unsigned int off; obd_id *data; - __u64 connect_flags; __u32 size; int rc = 0; ENTRY; @@ -491,14 +490,7 @@ static int mds_lov_get_objid(struct obd_device * obd, off = idx % OBJID_PER_PAGE(); data = mds->mds_lov_page_array[page]; - size = sizeof(__u64); - connect_flags = idx; - rc = obd_get_info(lov_exp, sizeof(KEY_CONNECT_FLAG), KEY_CONNECT_FLAG, - &size, &connect_flags, NULL); - if (rc) - GOTO(out, rc); - - if (data[off] < 2 || connect_flags & OBD_CONNECT_SKIP_ORPHAN) { + if (data[off] < 2) { /* We never read this lastid; ask the osc */ struct obd_id_info lastid; diff --git a/lustre/obdfilter/filter.c b/lustre/obdfilter/filter.c index 69e06be..1c485bb 100644 --- a/lustre/obdfilter/filter.c +++ b/lustre/obdfilter/filter.c @@ -3541,7 +3541,14 @@ static int filter_destroy_precreated(struct obd_export *exp, struct obdo *oa, filter_set_last_id(filter, id, doa.o_seq); rc = filter_update_last_objid(exp->exp_obd, doa.o_seq, 1); } else { - /* don't reuse orphan object, return last used objid */ + /* + * We have destroyed orphan objects, but don't want to reuse + * them. Therefore we don't reset last_id to the last created + * objects. Instead, we report back to the MDS the object id + * of the last orphan, so that the MDS can restart allocating + * objects from this id + 1 and thus skip the whole orphan + * object id range + */ oa->o_id = last; rc = 0; } diff --git a/lustre/osc/osc_create.c b/lustre/osc/osc_create.c index 6dfd1e4..815b15b 100644 --- a/lustre/osc/osc_create.c +++ b/lustre/osc/osc_create.c @@ -579,6 +579,11 @@ int osc_create(struct obd_export *exp, struct obdo *oa, oscc->oscc_last_id = oa->o_id; ocd = &imp->imp_connect_data; if (ocd->ocd_connect_flags & OBD_CONNECT_SKIP_ORPHAN) { + /* + * The OST reports back in oa->o_id from where + * we should restart in order to skip orphan + * objects + */ CDEBUG(D_HA, "%s: Skip orphan set, reset last " "objid\n", oscc->oscc_obd->obd_name); oscc->oscc_next_id = oa->o_id + 1; -- 1.8.3.1