Whamcloud - gitweb
LU-8403 obd: remove OBD_NOTIFY_SYNC{,_NONBLOCK} 21/21421/5
authorJohn L. Hammond <john.hammond@intel.com>
Tue, 19 Jul 2016 14:21:15 +0000 (09:21 -0500)
committerOleg Drokin <oleg.drokin@intel.com>
Wed, 1 Mar 2017 05:11:00 +0000 (05:11 +0000)
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 <john.hammond@intel.com>
Change-Id: I3bc2bd34b268b28777241555dae8896577150c91
Reviewed-on: https://review.whamcloud.com/21421
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/include/obd.h
lustre/lov/lov_obd.c

index 4094966..8cf5582 100644 (file)
@@ -534,9 +534,6 @@ enum obd_notify_event {
         OBD_NOTIFY_INACTIVE,
         /* Connect data for import were changed */
         OBD_NOTIFY_OCD,
         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 */
         /* Configuration event */
         OBD_NOTIFY_CONFIG,
         /* Administratively deactivate/activate event */
index f75b50e..5a2eebb 100644 (file)
@@ -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,
 }
 
 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;
        struct lov_obd *lov = &obd->u.lov;
-        ENTRY;
+       ENTRY;
 
        down_read(&lov->lov_notify_lock);
 
        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);
        up_read(&lov->lov_notify_lock);
-        RETURN(rc);
+
+       RETURN(rc);
 }
 
 static int lov_add_target(struct obd_device *obd, struct obd_uuid *uuidp,
 }
 
 static int lov_add_target(struct obd_device *obd, struct obd_uuid *uuidp,