From 8a2d8fa5f1ac58ec3c045599deed92e0f9df8d52 Mon Sep 17 00:00:00 2001 From: phil Date: Sun, 17 Aug 2003 17:42:36 +0000 Subject: [PATCH] Fix some tab damage and missing modeline --- lustre/osc/osc_create.c | 90 ++++++++++++++++++++++++++----------------------- 1 file changed, 48 insertions(+), 42 deletions(-) diff --git a/lustre/osc/osc_create.c b/lustre/osc/osc_create.c index f9c30d1e..37d8538 100644 --- a/lustre/osc/osc_create.c +++ b/lustre/osc/osc_create.c @@ -1,4 +1,6 @@ -/* +/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*- + * vim:expandtab:shiftwidth=8:tabstop=8: + * * Copyright (C) 2001-2003 Cluster File Systems, Inc. * Author Peter Braam * @@ -88,43 +90,46 @@ static struct osc_created osc_created; static int oscc_has_objects(struct osc_creator *oscc, int count) { - int rc; - spin_lock(&oscc->oscc_lock); - rc = (oscc->oscc_last_id - oscc->oscc_next_id >= count); - spin_unlock(&oscc->oscc_lock); - return rc; + int rc; + spin_lock(&oscc->oscc_lock); + rc = (oscc->oscc_last_id - oscc->oscc_next_id >= count); + spin_unlock(&oscc->oscc_lock); + return rc; } -static int oscc_precreate(struct osc_creator *oscc, struct osc_created *osccd, int wait) +static int oscc_precreate(struct osc_creator *oscc, struct osc_created *osccd, + int wait) { int rc = 0; struct l_wait_info lwi = { 0 }; + ENTRY; - if (oscc_has_objects(oscc, oscc->oscc_grow_count)) + if (oscc_has_objects(oscc, oscc->oscc_grow_count)) RETURN(0); spin_lock(&osccd->osccd_lock); spin_lock(&oscc->oscc_lock); if (list_empty(&oscc->oscc_list)) { list_add(&oscc->oscc_list, &osccd->osccd_queue_list_head); - osccd->osccd_flags |= OSCCD_KICKED; + osccd->osccd_flags |= OSCCD_KICKED; wake_up(&osccd->osccd_waitq); } spin_unlock(&oscc->oscc_lock); spin_unlock(&osccd->osccd_lock); - + /* an MDS using this call may time out on this. This is a * recovery style wait. */ if (wait) - rc = l_wait_event(oscc->oscc_waitq, oscc_has_objects(oscc, 1), &lwi); - if (rc || !wait) - RETURN(rc); - - spin_lock(&oscc->oscc_lock); - rc = oscc->oscc_status; - spin_unlock(&oscc->oscc_lock); - RETURN(rc); + rc = l_wait_event(oscc->oscc_waitq, oscc_has_objects(oscc, 1), + &lwi); + if (rc || !wait) + RETURN(rc); + + spin_lock(&oscc->oscc_lock); + rc = oscc->oscc_status; + spin_unlock(&oscc->oscc_lock); + RETURN(rc); } int osc_create(struct lustre_handle *exph, struct obdo *oa, @@ -138,7 +143,7 @@ int osc_create(struct lustre_handle *exph, struct obdo *oa, int try_again = 1; ENTRY; - class_export_put(export); + class_export_put(export); LASSERT(oa); LASSERT(ea); @@ -158,7 +163,7 @@ int osc_create(struct lustre_handle *exph, struct obdo *oa, *ea = lsm; oscc->oscc_next_id++; try_again = 0; - } + } spin_unlock(&oscc->oscc_lock); rc = oscc_precreate(oscc, osccd, try_again); } @@ -175,28 +180,26 @@ void osccd_do_create(struct osc_created *osccd) next: spin_lock(&osccd->osccd_lock); list_for_each (tmp, &osccd->osccd_queue_list_head) { - int rc; - struct osc_creator *oscc = list_entry(tmp, struct osc_creator, + int rc; + struct osc_creator *oscc = list_entry(tmp, struct osc_creator, oscc_list); list_del_init(&oscc->oscc_list); - list_add(&oscc->oscc_list, &osccd->osccd_work_list_head); + list_add(&oscc->oscc_list, &osccd->osccd_work_list_head); spin_unlock(&osccd->osccd_lock); - - rc = osc_real_create(oscc->oscc_exph, - &oscc->oscc_oa, - &oscc->oscc_ea, - NULL); + + rc = osc_real_create(oscc->oscc_exph, &oscc->oscc_oa, + &oscc->oscc_ea, NULL); spin_lock(&osccd->osccd_lock); - spin_lock(&oscc->oscc_lock); + spin_lock(&oscc->oscc_lock); list_del_init(&oscc->oscc_list); - oscc->oscc_status = rc; + oscc->oscc_status = rc; oscc->oscc_last_id = oscc->oscc_oa.o_id; - spin_unlock(&oscc->oscc_lock); + spin_unlock(&oscc->oscc_lock); spin_unlock(&osccd->osccd_lock); wake_up(&oscc->oscc_waitq); goto next; } - spin_unlock(&osccd->osccd_lock); + spin_unlock(&osccd->osccd_lock); } static int osccd_main(void *arg) @@ -232,7 +235,7 @@ static int osccd_main(void *arg) EXIT; break; } else { - osccd->osccd_flags &= ~OSCCD_KICKED; + osccd->osccd_flags &= ~OSCCD_KICKED; spin_unlock(&osccd->osccd_lock); osccd_do_create(osccd); } @@ -251,10 +254,10 @@ void oscc_init(struct lustre_handle *exph) { struct obd_export *exp = class_conn2export(exph); struct osc_export_data *oed = &exp->exp_osc_data; - int saved_grow_count; + int saved_grow_count; memset(oed, 0, sizeof(*oed)); - INIT_LIST_HEAD(&oed->oed_oscc.oscc_list); + INIT_LIST_HEAD(&oed->oed_oscc.oscc_list); init_waitqueue_head(&oed->oed_oscc.oscc_waitq); oed->oed_oscc.oscc_exph = exph; oed->oed_oscc.oscc_osccd = &osc_created; @@ -262,14 +265,14 @@ void oscc_init(struct lustre_handle *exph) oed->oed_oscc.oscc_grow_count = 1; oed->oed_oscc.oscc_initial_create_count = 1; - /* XXX the export handle should give the oscc the last object */ - /* oed->oed_oscc.oscc_last_id = exph->....; */ - saved_grow_count = oed->oed_oscc.oscc_grow_count; + /* XXX the export handle should give the oscc the last object */ + /* oed->oed_oscc.oscc_last_id = exph->....; */ + saved_grow_count = oed->oed_oscc.oscc_grow_count; oed->oed_oscc.oscc_grow_count = oed->oed_oscc.oscc_initial_create_count; - oscc_precreate(&oed->oed_oscc, oed->oed_oscc.oscc_osccd, 0); - oed->oed_oscc.oscc_grow_count = saved_grow_count; + oscc_precreate(&oed->oed_oscc, oed->oed_oscc.oscc_osccd, 0); + oed->oed_oscc.oscc_grow_count = saved_grow_count; - class_export_put(exp); + class_export_put(exp); } int osccd_setup(void) @@ -289,7 +292,8 @@ int osccd_setup(void) CERROR("cannot start thread\n"); RETURN(rc); } - l_wait_event(osccd->osccd_ctl_waitq, osccd->osccd_flags & OSCCD_RUNNING, &lwi); + l_wait_event(osccd->osccd_ctl_waitq, osccd->osccd_flags & OSCCD_RUNNING, + &lwi); RETURN(0); } @@ -297,6 +301,8 @@ int osccd_cleanup(void) { struct osc_created *osccd = &osc_created; struct l_wait_info lwi = { 0 }; + ENTRY; + spin_lock(&osccd->osccd_lock); osccd->osccd_flags = OSCCD_STOPPING; spin_unlock(&osccd->osccd_lock); -- 1.8.3.1