From patchwork Thu Jul 19 17:11:33 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 1218081 Return-Path: X-Original-To: patchwork-ceph-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 0923ADF24C for ; Thu, 19 Jul 2012 17:11:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752144Ab2GSRLg (ORCPT ); Thu, 19 Jul 2012 13:11:36 -0400 Received: from mail-gh0-f174.google.com ([209.85.160.174]:58965 "EHLO mail-gh0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752102Ab2GSRLf (ORCPT ); Thu, 19 Jul 2012 13:11:35 -0400 Received: by ghrr11 with SMTP id r11so3011822ghr.19 for ; Thu, 19 Jul 2012 10:11:35 -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:references :in-reply-to:content-type:content-transfer-encoding :x-gm-message-state; bh=1kL+apynQ0Eo1r1XwRkiYIwOVwT9mVB17M1pw9DNs4c=; b=M+V5Tis5gwfbxIuVkIVknRVV/fVssXUbZJx5otR1cDGtzqtJkDoSUU5r+BwF/Xu+t8 c34WwNNkJ414gwKi48kwjQhPzkWhQtVKyH9CPytsRMYrtIU8Ocrqc1tc2kkC7YoJfnCZ gPHUY8yRijVInODhCf8dVo7ZYKmb1ARD42kEi7W+9Mn0GNRpZCeE9FUnZcbk0E0v73ZF 3AREeKULZBigEYNeKoKAnRbtz91/ZXF13BWBpzDpjyHQRXli1+tmrO29nyS034yMoSMW h5LWkTmzopcYUEq206EfXtELcTXUchUiOyKqMQ8x5qd4b0KYR5f+rBTXe1SKxcy4YCwD VAIg== Received: by 10.50.220.194 with SMTP id py2mr2279784igc.15.1342717894963; Thu, 19 Jul 2012 10:11:34 -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 if4sm17329571igc.10.2012.07.19.10.11.34 (version=SSLv3 cipher=OTHER); Thu, 19 Jul 2012 10:11:34 -0700 (PDT) Message-ID: <50083FC5.3050902@inktank.com> Date: Thu, 19 Jul 2012 12:11:33 -0500 From: Alex Elder User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120615 Thunderbird/13.0.1 MIME-Version: 1.0 To: ceph-devel@vger.kernel.org Subject: [PATCH 1/4] rbd: don't use snapc->seq that way References: <50083F65.5030104@inktank.com> In-Reply-To: <50083F65.5030104@inktank.com> X-Gm-Message-State: ALoCoQnEkbgupBBZQVk30cYpbG9oZZdap99hZDJ7wHVXSHQvbTxq2/CahS+U7qqsJpeLt0m8i8fc Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org In what appears to be an artifact of a different way of encoding whether an rbd image maps a snapshot, __rbd_refresh_header() has code that arranges to update the seq value in an rbd image's snapshot context to point to the first entry in its snapshot array if that's where it was pointing initially. We now use rbd_dev->snap_id to record the snapshot id--using the special value SNAP_NONE to indicate the rbd_dev is not mapping a snapshot at all. There is therefore no need to check for this case, nor to update the seq value, in __rbd_refresh_header(). Just preserve the seq value that rbd_read_header() provides (which, at the moment, is nothing). Signed-off-by: Alex Elder Reviewed-by: Josh Durgin --- drivers/block/rbd.c | 14 -------------- 1 files changed, 0 insertions(+), 14 deletions(-) if (ret < 0) @@ -1735,13 +1733,6 @@ static int __rbd_refresh_header(struct rbd_device *rbd_dev) set_capacity(rbd_dev->disk, size); } - snap_seq = rbd_dev->header.snapc->seq; - if (rbd_dev->header.total_snaps && - rbd_dev->header.snapc->snaps[0] == snap_seq) - /* pointing at the head, will need to follow that - if head moves */ - follow_seq = 1; - /* rbd_dev->header.object_prefix shouldn't change */ kfree(rbd_dev->header.snap_sizes); kfree(rbd_dev->header.snap_names); @@ -1759,11 +1750,6 @@ static int __rbd_refresh_header(struct rbd_device *rbd_dev) WARN_ON(strcmp(rbd_dev->header.object_prefix, h.object_prefix)); kfree(h.object_prefix); - if (follow_seq) - rbd_dev->header.snapc->seq = rbd_dev->header.snapc->snaps[0]; - else - rbd_dev->header.snapc->seq = snap_seq; - ret = __rbd_init_snaps_header(rbd_dev); up_write(&rbd_dev->header_rwsem); diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index 4d3a1e0..8a46599 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c @@ -1718,8 +1718,6 @@ static int __rbd_refresh_header(struct rbd_device *rbd_dev) { int ret; struct rbd_image_header h; - u64 snap_seq; - int follow_seq = 0; ret = rbd_read_header(rbd_dev, &h);