[stgt] [PATCH 3/3] sheepdog: change a method for detecting invalidation of inode

Hitoshi Mitake mitake.hitoshi at lab.ntt.co.jp
Fri Sep 26 08:44:26 CEST 2014


Current method of detecting invalidation of inode can produce bunch of
error messages if a first object of VDI doesn't exist. This patch
updates the method: reading first one byte of inode object. It can
reduce needless and confusing error messages.

Signed-off-by: Hitoshi Mitake <mitake.hitoshi at lab.ntt.co.jp>
---
 usr/bs_sheepdog.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/usr/bs_sheepdog.c b/usr/bs_sheepdog.c
index 06f2995..b9b7067 100644
--- a/usr/bs_sheepdog.c
+++ b/usr/bs_sheepdog.c
@@ -817,18 +817,16 @@ static int is_refresh_required(struct sheepdog_access_info *ai)
  * 1: refresh is required
  */
 {
-	uint64_t first_oid = vid_to_data_oid(ai->inode.vdi_id, 0);
+	uint64_t inode_oid = vid_to_vdi_oid(ai->inode.vdi_id);
 	char dummy;
 	int need_reload_inode = 0;
 
 	/*
 	 * Check inode of this tgtd is invaldiated or not.
-	 * Reading which object isn't a problem. If the inode object is
-	 * invalidated, sheep returns SD_RES_INODE_INVALIDATED even if the
-	 * object doesn't exist. So we read the first one.
+	 * The inode object is the only one object which always exists.
 	 */
 
-	read_object(ai, &dummy, first_oid, ai->inode.nr_copies, sizeof(dummy),
+	read_object(ai, &dummy, inode_oid, ai->inode.nr_copies, sizeof(dummy),
 		    0, &need_reload_inode);
 
 	return need_reload_inode;
-- 
1.8.3.2

--
To unsubscribe from this list: send the line "unsubscribe stgt" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html



More information about the stgt mailing list