To allow having more than just read-only as Boolean state associated
with an rbd_device, replace the "read_only" field with a more
general "flags" field. The non-atomic versions of bit operations
are fine for our purposes.
Signed-off-by: Alex Elder <elder@xxxxxxxxxxxxx>
---
drivers/block/rbd.c | 14 ++++++++++----
1 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index e7b443a..da38804 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -176,7 +176,8 @@ struct rbd_device {
char snap_name[RBD_MAX_SNAP_NAME_LEN];
u32 cur_snap; /* index+1 of current snapshot within snap context
0 - for the head */
- int read_only;
+
+ unsigned long flags;
struct list_head node;
@@ -187,19 +188,24 @@ struct rbd_device {
struct device dev;
};
+/* Bit position definitions for the rbd_device->flags */
+enum {
+ RBD_DEV_FLAG_READ_ONLY,
+};
+
static inline bool rbd_dev_is_readonly(struct rbd_device *rbd_dev)
{
- return rbd_dev->read_only;
+ return test_bit(RBD_DEV_FLAG_READ_ONLY, &rbd_dev->flags);
}
static inline void rbd_dev_set_readonly(struct rbd_device *rbd_dev)
{
- rbd_dev->read_only = true;
+ __set_bit(RBD_DEV_FLAG_READ_ONLY, &rbd_dev->flags);
}
static inline void rbd_dev_clear_readonly(struct rbd_device *rbd_dev)
{
- rbd_dev->read_only = false;
+ __clear_bit(RBD_DEV_FLAG_READ_ONLY, &rbd_dev->flags);
}
static DEFINE_MUTEX(ctl_mutex); /* Serialize
open/close/setup/teardown */
--
1.7.5.4
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html