From patchwork Thu Jul 26 19:11:18 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 1244291 Return-Path: X-Original-To: patchwork-ceph-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id EC2523FC5A for ; Thu, 26 Jul 2012 19:11:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752235Ab2GZTLU (ORCPT ); Thu, 26 Jul 2012 15:11:20 -0400 Received: from mail-gg0-f174.google.com ([209.85.161.174]:61293 "EHLO mail-gg0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752089Ab2GZTLU (ORCPT ); Thu, 26 Jul 2012 15:11:20 -0400 Received: by gglu4 with SMTP id u4so2344356ggl.19 for ; Thu, 26 Jul 2012 12:11:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding:x-gm-message-state; bh=EiMKprtKAkGub+D+T+mvI/eanHhXzspy/He3xtHi/bQ=; b=EFHxovQTrB4qrdhwHkpFjNgaQeibOTwbNe4unePPbR5KDpS3ySkroLsFLVRtI8WM26 WlljGsyMngZKaWAvPmpDwf1+wRtdpo+ATPDxCB6hBwAxMs2wHMELvb7MtW8zHEfgQ7Fy Eo18ssDzs5sXz3DV9PN69Mv3uW/mWOdtVhV/td84kZ5YT4tjdmp8XpeP6NLiruaHYbtm Vjth/gdkyQ8SB42uXoohhhFthWHPhoN2ngzZ4YeTG4bgHBTebotZNaFZRgRdP1SMSI/o 8Uh5UaV+JyjEtYcVe+pXtItfD5Nuss/Q1y0rQbNTi9h8OzCsuhhjY/zKvhklRBGqkNOi 0esg== Received: by 10.236.125.133 with SMTP id z5mr19709403yhh.121.1343329879405; Thu, 26 Jul 2012 12:11:19 -0700 (PDT) Received: from [172.22.22.4] (c-71-195-31-37.hsd1.mn.comcast.net. [71.195.31.37]) by mx.google.com with ESMTPS id j10sm26174anl.20.2012.07.26.12.11.18 (version=SSLv3 cipher=OTHER); Thu, 26 Jul 2012 12:11:19 -0700 (PDT) Message-ID: <50119656.9080709@inktank.com> Date: Thu, 26 Jul 2012 14:11:18 -0500 From: Alex Elder User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120714 Thunderbird/14.0 MIME-Version: 1.0 To: ceph-devel@vger.kernel.org Subject: [PATCH] rbd: kill rbd_init_watch_dev() X-Gm-Message-State: ALoCoQmrT4C43AluPktXzH1K8ruwJMkcbLGTiTHy/Mcm5TYdovfEL5qcMLmecSV4Uew+GOQn0Pe/ Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org When an rbd image is mapped, a watch request is issued so that the client will get notified in the event the image header object changes. This is done using rbd_init_watch_dev(), which calls rbd_req_sync_watch(). rbd_init_watch_dev() is organized as a loop, arranging to re-issue the request after refreshing the header if -ERANGE ever gets returned. But the only way rbd_req_sync_watch() will return -ERANGE is if the CEPH_OSD_OP_WATCH operation returns that, which it will not. As a result, the whole looping structure and in fact the whole function becomes excessive. So get rid of rbd_init_watch_dev(), and call rbd_req_sync_watch() directly in the one place it's used. Signed-off-by: Alex Elder --- drivers/block/rbd.c | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) /* @@ -2510,7 +2494,7 @@ static ssize_t rbd_add(struct bus_type *bus, if (rc) goto err_out_bus; - rc = rbd_init_watch_dev(rbd_dev); + rc = rbd_req_sync_watch(rbd_dev); if (rc) goto err_out_bus; diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index 94d0745..71e3f3b 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c @@ -2191,22 +2191,6 @@ static void rbd_bus_del_dev(struct rbd_device *rbd_dev) device_unregister(&rbd_dev->dev); } -static int rbd_init_watch_dev(struct rbd_device *rbd_dev) -{ - int ret, rc; - - do { - ret = rbd_req_sync_watch(rbd_dev); - if (ret == -ERANGE) { - rc = rbd_refresh_header(rbd_dev, NULL); - if (rc < 0) - return rc; - } - } while (ret == -ERANGE); - - return ret; -} - static atomic64_t rbd_id_max = ATOMIC64_INIT(0);