From 2789a4b0852a97a10eda6b3ffd6166f6d99d329f Mon Sep 17 00:00:00 2001 From: "John L. Hammond" Date: Tue, 19 Jul 2016 09:21:15 -0500 Subject: [PATCH] LU-8403 obd: remove OBD_NOTIFY_SYNC{,_NONBLOCK} None of the OBD notify handlers listen for OBD_NOTIFY_SYNC{,_NONBLOCK} events so remove them and related code in lov_notify(). Signed-off-by: John L. Hammond Change-Id: I3bc2bd34b268b28777241555dae8896577150c91 Reviewed-on: https://review.whamcloud.com/21421 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: James Simmons Reviewed-by: Oleg Drokin --- lustre/include/obd.h | 3 -- lustre/lov/lov_obd.c | 98 +++++++++++++++++----------------------------------- 2 files changed, 32 insertions(+), 69 deletions(-) diff --git a/lustre/include/obd.h b/lustre/include/obd.h index 4094966..8cf5582 100644 --- a/lustre/include/obd.h +++ b/lustre/include/obd.h @@ -534,9 +534,6 @@ enum obd_notify_event { OBD_NOTIFY_INACTIVE, /* Connect data for import were changed */ OBD_NOTIFY_OCD, - /* Sync request */ - OBD_NOTIFY_SYNC_NONBLOCK, - OBD_NOTIFY_SYNC, /* Configuration event */ OBD_NOTIFY_CONFIG, /* Administratively deactivate/activate event */ diff --git a/lustre/lov/lov_obd.c b/lustre/lov/lov_obd.c index f75b50e..5a2eebb 100644 --- a/lustre/lov/lov_obd.c +++ b/lustre/lov/lov_obd.c @@ -444,85 +444,51 @@ static int lov_set_osc_active(struct obd_device *obd, struct obd_uuid *uuid, } static int lov_notify(struct obd_device *obd, struct obd_device *watched, - enum obd_notify_event ev, void *data) + enum obd_notify_event ev, void *data) { - int rc = 0; + int rc = 0; struct lov_obd *lov = &obd->u.lov; - ENTRY; + ENTRY; down_read(&lov->lov_notify_lock); - if (!lov->lov_connects) { - up_read(&lov->lov_notify_lock); - RETURN(rc); - } - - if (ev == OBD_NOTIFY_ACTIVE || ev == OBD_NOTIFY_INACTIVE || - ev == OBD_NOTIFY_ACTIVATE || ev == OBD_NOTIFY_DEACTIVATE) { - struct obd_uuid *uuid; + if (!lov->lov_connects) + GOTO(out_notify_lock, rc = 0); - LASSERT(watched); + if (ev == OBD_NOTIFY_ACTIVE || ev == OBD_NOTIFY_INACTIVE || + ev == OBD_NOTIFY_ACTIVATE || ev == OBD_NOTIFY_DEACTIVATE) { + struct obd_uuid *uuid; - if (strcmp(watched->obd_type->typ_name, LUSTRE_OSC_NAME)) { - up_read(&lov->lov_notify_lock); - CERROR("unexpected notification of %s %s!\n", - watched->obd_type->typ_name, - watched->obd_name); - RETURN(-EINVAL); - } - uuid = &watched->u.cli.cl_target_uuid; - - /* Set OSC as active before notifying the observer, so the - * observer can use the OSC normally. - */ - rc = lov_set_osc_active(obd, uuid, ev); - if (rc < 0) { - up_read(&lov->lov_notify_lock); - CERROR("event(%d) of %s failed: %d\n", ev, - obd_uuid2str(uuid), rc); - RETURN(rc); - } - /* active event should be pass lov target index as data */ - data = &rc; - } + LASSERT(watched); - /* Pass the notification up the chain. */ - if (watched) { - rc = obd_notify_observer(obd, watched, ev, data); - } else { - /* NULL watched means all osc's in the lov (only for syncs) */ - /* sync event should be send lov idx as data */ - struct lov_obd *lov = &obd->u.lov; - int i, is_sync; + if (strcmp(watched->obd_type->typ_name, LUSTRE_OSC_NAME)) { + CERROR("unexpected notification of %s %s\n", + watched->obd_type->typ_name, watched->obd_name); + GOTO(out_notify_lock, rc = -EINVAL); + } - data = &i; - is_sync = (ev == OBD_NOTIFY_SYNC) || - (ev == OBD_NOTIFY_SYNC_NONBLOCK); + uuid = &watched->u.cli.cl_target_uuid; - obd_getref(obd); - for (i = 0; i < lov->desc.ld_tgt_count; i++) { - if (!lov->lov_tgts[i]) - continue; + /* Set OSC as active before notifying the observer, so the + * observer can use the OSC normally. + */ + rc = lov_set_osc_active(obd, uuid, ev); + if (rc < 0) { + CERROR("%s: event %d failed: rc = %d\n", obd->obd_name, + ev, rc); + GOTO(out_notify_lock, rc); + } - /* don't send sync event if target not - * connected/activated */ - if (is_sync && !lov->lov_tgts[i]->ltd_active) - continue; + /* active event should be pass lov target index as data */ + data = &rc; + } - rc = obd_notify_observer(obd, lov->lov_tgts[i]->ltd_obd, - ev, data); - if (rc) { - CERROR("%s: notify %s of %s failed %d\n", - obd->obd_name, - obd->obd_observer->obd_name, - lov->lov_tgts[i]->ltd_obd->obd_name, - rc); - } - } - obd_putref(obd); - } + /* Pass the notification up the chain. */ + rc = obd_notify_observer(obd, watched, ev, data); +out_notify_lock: up_read(&lov->lov_notify_lock); - RETURN(rc); + + RETURN(rc); } static int lov_add_target(struct obd_device *obd, struct obd_uuid *uuidp, -- 1.8.3.1