/* Obd flag bits */
enum {
- OBDF_NUM_FLAGS,
+ OBDF_ATTACHED, /* finished attach */
+ OBDF_NUM_FLAGS,
};
/* corresponds to one of the obd's */
/* bitfield modification is protected by obd_dev_lock */
DECLARE_BITMAP(obd_flags, OBDF_NUM_FLAGS);
unsigned long
- obd_attached:1, /* finished attach */
obd_set_up:1, /* finished setup */
obd_recovering:1, /* there are recoverable clients */
obd_abort_recovery:1, /* abort client and MDT recovery */
/* disk obd */
tgt = class_name2obd(lustre_cfg_string(lcfg, 1));
- if (!tgt || !tgt->obd_attached || !tgt->obd_set_up) {
+ if (!tgt || !test_bit(OBDF_ATTACHED, tgt->obd_flags) || !tgt->obd_set_up) {
CERROR("target device not attached or not set up (%s)\n",
lustre_cfg_string(lcfg, 1));
RETURN(-EINVAL);
status = "IN";
else if (obd->obd_set_up)
status = "UP";
- else if (obd->obd_attached)
+ else if (test_bit(OBDF_ATTACHED, obd->obd_flags))
status = "AT";
else
status = "--";
* out any references
*/
LASSERT(obd->obd_magic == OBD_DEVICE_MAGIC);
- if (obd->obd_attached) {
+ if (test_bit(OBDF_ATTACHED, obd->obd_flags)) {
ret = obd->obd_minor;
return ret;
}
* out any references
*/
LASSERT(obd->obd_magic == OBD_DEVICE_MAGIC);
- if (obd->obd_attached)
+ if (test_bit(OBDF_ATTACHED, obd->obd_flags))
break;
}
}
* out any references
*/
LASSERT(obd->obd_magic == OBD_DEVICE_MAGIC);
- if (obd->obd_attached) {
+ if (test_bit(OBDF_ATTACHED, obd->obd_flags)) {
class_incref(obd, "find", current);
break;
}
status = "IN";
else if (obd->obd_set_up)
status = "UP";
- else if (obd->obd_attached)
+ else if (test_bit(OBDF_ATTACHED, obd->obd_flags))
status = "AT";
else
status = "--";
RETURN(rc);
}
- obd->obd_attached = 1;
+ set_bit(OBDF_ATTACHED, obd->obd_flags);
CDEBUG(D_IOCTL, "OBD: dev %d attached type %s with refcount %d\n",
obd->obd_minor, typename, kref_read(&obd->obd_refcount));
obd, obd->obd_magic, OBD_DEVICE_MAGIC);
/* have we attached a type to this device? */
- if (!obd->obd_attached) {
+ if (!test_bit(OBDF_ATTACHED, obd->obd_flags)) {
CERROR("Device %d not attached\n", obd->obd_minor);
RETURN(-ENODEV);
}
}
spin_lock(&obd->obd_dev_lock);
- if (!obd->obd_attached) {
+ if (!test_bit(OBDF_ATTACHED, obd->obd_flags)) {
spin_unlock(&obd->obd_dev_lock);
CERROR("OBD device %d not attached\n", obd->obd_minor);
RETURN(-ENODEV);
}
- obd->obd_attached = 0;
+ clear_bit(OBDF_ATTACHED, obd->obd_flags);
/* cleanup in progress. we don't like to find this device after now */
class_unregister_device(obd);
struct obd_export *exp;
obd = container_of(kref, struct obd_device, obd_refcount);
- LASSERT(!obd->obd_attached);
+ LASSERT(!test_bit(OBDF_ATTACHED, obd->obd_flags));
/*
* All exports have been destroyed; there should
* be no more in-progress ops by this point.
return rc;
obd = class_num2obd(idx);
- if (!obd || !obd->obd_attached) {
+ if (!obd || !test_bit(OBDF_ATTACHED, obd->obd_flags)) {
if (obd)
CERROR("%s: not attached\n", obd->obd_name);
return -ENODEV;
return sprintf(buf, "LBUG\n");
obd_device_lock();
- obd_device_for_each_cond(dev_no, obd, obd->obd_attached &&
+ obd_device_for_each_cond(dev_no, obd, test_bit(OBDF_ATTACHED, obd->obd_flags) &&
obd->obd_set_up && !obd->obd_stopping &&
!obd->obd_read_only) {
LASSERT(obd->obd_magic == OBD_DEVICE_MAGIC);
status = "IN";
else if (obd->obd_set_up)
status = "UP";
- else if (obd->obd_attached)
+ else if (test_bit(OBDF_ATTACHED, obd->obd_flags))
status = "AT";
else
status = "--";
unsigned long dev_no = 0;
obd_device_lock();
- obd_device_for_each_cond(dev_no, obd, obd->obd_attached &&
+ obd_device_for_each_cond(dev_no, obd, test_bit(OBDF_ATTACHED, obd->obd_flags) &&
obd->obd_set_up && !obd->obd_stopping) {
LASSERT(obd->obd_magic == OBD_DEVICE_MAGIC);
}
tgt = class_name2obd(lustre_cfg_string(lcfg, 1));
- if (!tgt || !tgt->obd_attached || !tgt->obd_set_up) {
+ if (!tgt || !test_bit(OBDF_ATTACHED, tgt->obd_flags) || !tgt->obd_set_up) {
CERROR("device not attached or not set up (%s)\n",
lustre_cfg_string(lcfg, 1));
RETURN(-EINVAL);