Commit 98571b5a authored by Alex Elder's avatar Alex Elder

rbd: small changes

A few very minor changes to the rbd code:
    - RBD_MAX_OPT_LEN is unused, so get rid of it
    - Consolidate rbd options definitions
    - Make rbd_segment_name() return pointer to const char
Signed-off-by: default avatarAlex Elder <elder@inktank.com>
Reviewed-by: default avatarDan Mick <dan.mick@inktank.com>
Reviewed-by: default avatarJosh Durgin <josh.durgin@inktank.com>
parent e0b49868
...@@ -69,7 +69,6 @@ ...@@ -69,7 +69,6 @@
(NAME_MAX - (sizeof (RBD_SNAP_DEV_NAME_PREFIX) - 1)) (NAME_MAX - (sizeof (RBD_SNAP_DEV_NAME_PREFIX) - 1))
#define RBD_MAX_SNAP_COUNT 510 /* allows max snapc to fit in 4KB */ #define RBD_MAX_SNAP_COUNT 510 /* allows max snapc to fit in 4KB */
#define RBD_MAX_OPT_LEN 1024
#define RBD_SNAP_HEAD_NAME "-" #define RBD_SNAP_HEAD_NAME "-"
...@@ -96,8 +95,6 @@ ...@@ -96,8 +95,6 @@
#define DEV_NAME_LEN 32 #define DEV_NAME_LEN 32
#define MAX_INT_FORMAT_WIDTH ((5 * sizeof (int)) / 2 + 1) #define MAX_INT_FORMAT_WIDTH ((5 * sizeof (int)) / 2 + 1)
#define RBD_READ_ONLY_DEFAULT false
/* /*
* block device image metadata (in-memory version) * block device image metadata (in-memory version)
*/ */
...@@ -156,10 +153,6 @@ struct rbd_spec { ...@@ -156,10 +153,6 @@ struct rbd_spec {
struct kref kref; struct kref kref;
}; };
struct rbd_options {
bool read_only;
};
/* /*
* an instance of the client. multiple devices may share an rbd client. * an instance of the client. multiple devices may share an rbd client.
*/ */
...@@ -475,6 +468,12 @@ static match_table_t rbd_opts_tokens = { ...@@ -475,6 +468,12 @@ static match_table_t rbd_opts_tokens = {
{-1, NULL} {-1, NULL}
}; };
struct rbd_options {
bool read_only;
};
#define RBD_READ_ONLY_DEFAULT false
static int parse_rbd_opts_token(char *c, void *private) static int parse_rbd_opts_token(char *c, void *private)
{ {
struct rbd_options *rbd_opts = private; struct rbd_options *rbd_opts = private;
...@@ -773,7 +772,7 @@ static void rbd_header_free(struct rbd_image_header *header) ...@@ -773,7 +772,7 @@ static void rbd_header_free(struct rbd_image_header *header)
header->snapc = NULL; header->snapc = NULL;
} }
static char *rbd_segment_name(struct rbd_device *rbd_dev, u64 offset) static const char *rbd_segment_name(struct rbd_device *rbd_dev, u64 offset)
{ {
char *name; char *name;
u64 segment; u64 segment;
...@@ -1338,7 +1337,7 @@ static int rbd_do_op(struct request *rq, ...@@ -1338,7 +1337,7 @@ static int rbd_do_op(struct request *rq,
struct rbd_req_coll *coll, struct rbd_req_coll *coll,
int coll_index) int coll_index)
{ {
char *seg_name; const char *seg_name;
u64 seg_ofs; u64 seg_ofs;
u64 seg_len; u64 seg_len;
int ret; int ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment