aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Elder <elder@inktank.com>2012-11-09 16:05:54 -0500
committerAlex Elder <elder@inktank.com>2012-12-17 09:37:29 -0500
commit2fd82b9e92c2a718ae81fc987b4468ceeee6979b (patch)
treee41b1c8522f4f0e63d72b180131e59ee980c9ad5
parent685a7555ca69030739ddb57a47f0ea8ea80196a4 (diff)
rbd: get rid of RBD_MAX_SEG_NAME_LEN
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>
-rw-r--r--drivers/block/rbd.c6
-rw-r--r--drivers/block/rbd_types.h2
2 files changed, 3 insertions, 5 deletions
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index c7bf9613ad40..ce26b749ede0 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -740,13 +740,13 @@ static char *rbd_segment_name(struct rbd_device *rbd_dev, u64 offset)
740 u64 segment; 740 u64 segment;
741 int ret; 741 int ret;
742 742
743 name = kmalloc(RBD_MAX_SEG_NAME_LEN + 1, GFP_NOIO); 743 name = kmalloc(MAX_OBJ_NAME_SIZE + 1, GFP_NOIO);
744 if (!name) 744 if (!name)
745 return NULL; 745 return NULL;
746 segment = offset >> rbd_dev->header.obj_order; 746 segment = offset >> rbd_dev->header.obj_order;
747 ret = snprintf(name, RBD_MAX_SEG_NAME_LEN, "%s.%012llx", 747 ret = snprintf(name, MAX_OBJ_NAME_SIZE + 1, "%s.%012llx",
748 rbd_dev->header.object_prefix, segment); 748 rbd_dev->header.object_prefix, segment);
749 if (ret < 0 || ret >= RBD_MAX_SEG_NAME_LEN) { 749 if (ret < 0 || ret > MAX_OBJ_NAME_SIZE) {
750 pr_err("error formatting segment name for #%llu (%d)\n", 750 pr_err("error formatting segment name for #%llu (%d)\n",
751 segment, ret); 751 segment, ret);
752 kfree(name); 752 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 @@
46#define RBD_MIN_OBJ_ORDER 16 46#define RBD_MIN_OBJ_ORDER 16
47#define RBD_MAX_OBJ_ORDER 30 47#define RBD_MAX_OBJ_ORDER 30
48 48
49#define RBD_MAX_SEG_NAME_LEN 128
50
51#define RBD_COMP_NONE 0 49#define RBD_COMP_NONE 0
52#define RBD_CRYPT_NONE 0 50#define RBD_CRYPT_NONE 0
53 51