diff options
author | Alex Elder <elder@inktank.com> | 2012-11-09 15:05:54 -0600 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-01-17 08:46:49 -0800 |
commit | 495f76eadab76742d4060130604306bfaaafca24 (patch) | |
tree | 48ed28aee7803e910459feaf870f559c6bc9267f | |
parent | f14e81d15cd37d89b880226f2ad3b234e8e629c7 (diff) | |
download | lwn-495f76eadab76742d4060130604306bfaaafca24.tar.gz lwn-495f76eadab76742d4060130604306bfaaafca24.zip |
rbd: get rid of RBD_MAX_SEG_NAME_LEN
(cherry picked from commit 2fd82b9e92c2a718ae81fc987b4468ceeee6979b)
RBD_MAX_SEG_NAME_LEN represents the maximum length of an rbd object
name (i.e., one of the objects providing storage backing an rbd
image).
Another symbol, MAX_OBJ_NAME_SIZE, is used in the osd client code to
define the maximum length of any object name in an osd request.
Right now they disagree, with RBD_MAX_SEG_NAME_LEN being too big.
There's no real benefit at this point to defining the rbd object
name length limit separate from any other object name, so just
get rid of RBD_MAX_SEG_NAME_LEN and use MAX_OBJ_NAME_SIZE in its
place.
Signed-off-by: Alex Elder <elder@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/block/rbd.c | 6 | ||||
-rw-r--r-- | drivers/block/rbd_types.h | 2 |
2 files changed, 3 insertions, 5 deletions
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index 0badad7a5c77..67de1244dcf2 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c @@ -706,13 +706,13 @@ static char *rbd_segment_name(struct rbd_device *rbd_dev, u64 offset) u64 segment; int ret; - name = kmalloc(RBD_MAX_SEG_NAME_LEN + 1, GFP_NOIO); + name = kmalloc(MAX_OBJ_NAME_SIZE + 1, GFP_NOIO); if (!name) return NULL; segment = offset >> rbd_dev->header.obj_order; - ret = snprintf(name, RBD_MAX_SEG_NAME_LEN, "%s.%012llx", + ret = snprintf(name, MAX_OBJ_NAME_SIZE + 1, "%s.%012llx", rbd_dev->header.object_prefix, segment); - if (ret < 0 || ret >= RBD_MAX_SEG_NAME_LEN) { + if (ret < 0 || ret > MAX_OBJ_NAME_SIZE) { pr_err("error formatting segment name for #%llu (%d)\n", segment, ret); kfree(name); diff --git a/drivers/block/rbd_types.h b/drivers/block/rbd_types.h index cbe77fa105ba..49d77cbcf8bd 100644 --- a/drivers/block/rbd_types.h +++ b/drivers/block/rbd_types.h @@ -46,8 +46,6 @@ #define RBD_MIN_OBJ_ORDER 16 #define RBD_MAX_OBJ_ORDER 30 -#define RBD_MAX_SEG_NAME_LEN 128 - #define RBD_COMP_NONE 0 #define RBD_CRYPT_NONE 0 |