From 74f4d7b3f173674af8d05ab445f0bb11b557c20e Mon Sep 17 00:00:00 2001 From: Li Wei Date: Fri, 30 Aug 2013 15:12:40 +0800 Subject: [PATCH] LU-4263 osd-zfs: Avoid converting last ID FIDs to OST IDs When obdfilter-survey first creates an object on a fresh ZFS OST, the last ID object for FID_SEQ_ECHO has to be created in the first place. The last ID FID, [FID_SEQ_ECHO:0:0], can not be converted to an OST ID because the resulting OST ID would be indistinguishable from an FID_SEQ_OST_MDT0 OST ID and would confuse ostid_id(). This patch checks for last ID FIDs before converting them to OST IDs in osd_get_idx_for_ost_obj(). Change-Id: I96cdf85b4725e4882cecabaf90466c7f77a5e0a6 Intel-bug-id: FF-182 Signed-off-by: Li Wei Reviewed-on: http://review.whamcloud.com/8301 Tested-by: Maloo Reviewed-by: Fan Yong Reviewed-by: Andreas Dilger Tested-by: Jenkins Reviewed-by: Oleg Drokin --- lustre/osd-zfs/osd_oi.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/lustre/osd-zfs/osd_oi.c b/lustre/osd-zfs/osd_oi.c index 00ce2ea..4acbd0d6 100644 --- a/lustre/osd-zfs/osd_oi.c +++ b/lustre/osd-zfs/osd_oi.c @@ -371,6 +371,7 @@ osd_get_idx_for_ost_obj(const struct lu_env *env, struct osd_device *osd, { struct osd_seq *osd_seq; unsigned long b; + obd_id id; int rc; osd_seq = osd_find_or_add_seq(env, osd, fid_seq(fid)); @@ -380,12 +381,18 @@ osd_get_idx_for_ost_obj(const struct lu_env *env, struct osd_device *osd, return PTR_ERR(osd_seq); } - rc = fid_to_ostid(fid, &osd_oti_get(env)->oti_ostid); - LASSERT(rc == 0); /* we should not get here with IGIF */ - b = ostid_id(&osd_oti_get(env)->oti_ostid) % OSD_OST_MAP_SIZE; + if (fid_is_last_id(fid)) { + id = 0; + } else { + rc = fid_to_ostid(fid, &osd_oti_get(env)->oti_ostid); + LASSERT(rc == 0); /* we should not get here with IGIF */ + id = ostid_id(&osd_oti_get(env)->oti_ostid); + } + + b = id % OSD_OST_MAP_SIZE; LASSERT(osd_seq->os_compat_dirs[b]); - sprintf(buf, LPU64, ostid_id(&osd_oti_get(env)->oti_ostid)); + sprintf(buf, LPU64, id); return osd_seq->os_compat_dirs[b]; } -- 1.8.3.1