Browse Source

ceph: include preferred osd in placement seed

Mix the preferred osd (if any) into the placement seed that is fed into
the CRUSH object placement calculation.  This prevents all the placement
pgs from peering with the same osds.

Rev the osd client protocol with this change.

Signed-off-by: Sage Weil <sage@newdream.net>
Sage Weil 15 years ago
parent
commit
ee7fdfaff7
2 changed files with 3 additions and 1 deletions
  1. 1 1
      fs/ceph/ceph_fs.h
  2. 2 0
      fs/ceph/osdmap.c

+ 1 - 1
fs/ceph/ceph_fs.h

@@ -38,7 +38,7 @@
 #define CEPH_OSD_PROTOCOL     7 /* cluster internal */
 #define CEPH_OSD_PROTOCOL     7 /* cluster internal */
 #define CEPH_MDS_PROTOCOL     9 /* cluster internal */
 #define CEPH_MDS_PROTOCOL     9 /* cluster internal */
 #define CEPH_MON_PROTOCOL     5 /* cluster internal */
 #define CEPH_MON_PROTOCOL     5 /* cluster internal */
-#define CEPH_OSDC_PROTOCOL   20 /* server/client */
+#define CEPH_OSDC_PROTOCOL   21 /* server/client */
 #define CEPH_MDSC_PROTOCOL   29 /* server/client */
 #define CEPH_MDSC_PROTOCOL   29 /* server/client */
 #define CEPH_MONC_PROTOCOL   15 /* server/client */
 #define CEPH_MONC_PROTOCOL   15 /* server/client */
 
 

+ 2 - 0
fs/ceph/osdmap.c

@@ -791,6 +791,8 @@ int ceph_calc_object_layout(struct ceph_object_layout *ol,
 	pgid.pg64 = 0;   /* start with it zeroed out */
 	pgid.pg64 = 0;   /* start with it zeroed out */
 	pgid.pg.ps = ceph_full_name_hash(oid, strlen(oid));
 	pgid.pg.ps = ceph_full_name_hash(oid, strlen(oid));
 	pgid.pg.preferred = preferred;
 	pgid.pg.preferred = preferred;
+	if (preferred >= 0)
+		pgid.pg.ps += preferred;
 	pgid.pg.pool = le32_to_cpu(fl->fl_pg_pool);
 	pgid.pg.pool = le32_to_cpu(fl->fl_pg_pool);
 	if (preferred >= 0)
 	if (preferred >= 0)
 		dout("calc_object_layout '%s' pgid %d.%xp%d (%llx)\n", oid,
 		dout("calc_object_layout '%s' pgid %d.%xp%d (%llx)\n", oid,