diff options
author | Aya Mahfouz <mahfouz.saif.elyazal@gmail.com> | 2015-04-02 20:00:24 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-04-03 11:18:14 +0200 |
commit | f36b6553e0ffe2c06ffc025b23c13967754ce7f4 (patch) | |
tree | bf265507e88c83b33432d3730a9a73d9dab6ac10 /drivers/staging/lustre | |
parent | 4ca1b8fbe609b7c52aeaa78a5f4678efcc9b8d73 (diff) | |
download | op-kernel-dev-f36b6553e0ffe2c06ffc025b23c13967754ce7f4.zip op-kernel-dev-f36b6553e0ffe2c06ffc025b23c13967754ce7f4.tar.gz |
staging: lustre: include: replace OBD_CHECK_DEV_ACTIVE by obd_check_dev_active
Static inline functions are preferred over macros. The inline function
obd_check_dev_active is introduced to replace OBD_CHECK_DEV_ACTIVE.
All functions that call obd_check_dev_active store the return values
and return them if they represent an error code.
Some of the changes were carried out manually while others were done
using coccinelle.
Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/lustre')
-rw-r--r-- | drivers/staging/lustre/lustre/include/obd_class.h | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/drivers/staging/lustre/lustre/include/obd_class.h b/drivers/staging/lustre/lustre/include/obd_class.h index 9167164..e533cff 100644 --- a/drivers/staging/lustre/lustre/include/obd_class.h +++ b/drivers/staging/lustre/lustre/include/obd_class.h @@ -361,6 +361,19 @@ do { \ } \ } while (0) +static inline int obd_check_dev_active(struct obd_device *obd) +{ + int rc; + + rc = obd_check_dev(obd); + if (rc) + return rc; + if (!obd->obd_set_up || obd->obd_stopping) { + CERROR("Device %d not setup\n", obd->obd_minor); + return -ENODEV; + } + return rc; +} #if defined (CONFIG_PROC_FS) #define OBD_COUNTER_OFFSET(op) \ @@ -901,7 +914,9 @@ static inline int obd_add_conn(struct obd_import *imp, struct obd_uuid *uuid, struct obd_device *obd = imp->imp_obd; int rc; - OBD_CHECK_DEV_ACTIVE(obd); + rc = obd_check_dev_active(obd); + if (rc) + return rc; OBD_CHECK_DT_OP(obd, add_conn, -EOPNOTSUPP); OBD_COUNTER_INCREMENT(obd, add_conn); @@ -914,7 +929,9 @@ static inline int obd_del_conn(struct obd_import *imp, struct obd_uuid *uuid) struct obd_device *obd = imp->imp_obd; int rc; - OBD_CHECK_DEV_ACTIVE(obd); + rc = obd_check_dev_active(obd); + if (rc) + return rc; OBD_CHECK_DT_OP(obd, del_conn, -EOPNOTSUPP); OBD_COUNTER_INCREMENT(obd, del_conn); @@ -948,7 +965,9 @@ static inline int obd_connect(const struct lu_env *env, __u64 ocf = data ? data->ocd_connect_flags : 0; /* for post-condition * check */ - OBD_CHECK_DEV_ACTIVE(obd); + rc = obd_check_dev_active(obd); + if (rc) + return rc; OBD_CHECK_DT_OP(obd, connect, -EOPNOTSUPP); OBD_COUNTER_INCREMENT(obd, connect); @@ -970,7 +989,9 @@ static inline int obd_reconnect(const struct lu_env *env, __u64 ocf = d ? d->ocd_connect_flags : 0; /* for post-condition * check */ - OBD_CHECK_DEV_ACTIVE(obd); + rc = obd_check_dev_active(obd); + if (rc) + return rc; OBD_CHECK_DT_OP(obd, reconnect, 0); OBD_COUNTER_INCREMENT(obd, reconnect); |