From patchwork Thu Jul 26 18:44:47 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 1244071 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 5FB473FC5A for ; Thu, 26 Jul 2012 18:44:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752060Ab2GZSow (ORCPT ); Thu, 26 Jul 2012 14:44:52 -0400 Received: from mail-yw0-f46.google.com ([209.85.213.46]:34666 "EHLO mail-yw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751941Ab2GZSow (ORCPT ); Thu, 26 Jul 2012 14:44:52 -0400 Received: by yhmm54 with SMTP id m54so2323144yhm.19 for ; Thu, 26 Jul 2012 11:44:51 -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=SekDUaOfhKJ+zzSOHPE00L76wnuIqHmtv2mWfUyuk6o=; b=lbGUEBct+QLUZ+LiirbSGW0KWWS1jtCtwnPTupOTi2vJANnBGXRJhwd4+LWtanWXsN 9IdEU7dJFwgn3vX9BqjckXR16exyEgkGdgQebwVBq65vfCr4ZFOUNwHmfdMzjtBD6tZl sHtg6dm5r9IdWQ9KgJlppzOevaBT63U73GSWbyykzfzrNujA85BNxtJzkV0wBAJ0oD89 lLHzI4tCP2/AGyzr9cnMWvx12+G6OvKFpcwQ4tqkEojPAOjWyJf2ghlq+BgFfkHRojwY WKg4uM3S1xFTXoeGEcRlNpYCRrZ9pb2UAWCyUQpJHyi3/qVfJRTOZc63g4yA7f5O23GX P7yg== Received: by 10.236.177.42 with SMTP id c30mr28327020yhm.37.1343328291585; Thu, 26 Jul 2012 11:44:51 -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 y10sm42549288yhd.6.2012.07.26.11.44.47 (version=SSLv3 cipher=OTHER); Thu, 26 Jul 2012 11:44:50 -0700 (PDT) Message-ID: <5011901F.2020704@inktank.com> Date: Thu, 26 Jul 2012 13:44:47 -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 2/6] rbd: simplify __rbd_remove_all_snaps() References: <50118F33.7080502@inktank.com> In-Reply-To: <50118F33.7080502@inktank.com> X-Gm-Message-State: ALoCoQkZfbor2w8P1WTdF0QJgQmYeuQD7ZOiTL8KIaRyOZqL8ZaWukr8VQQ0kEeHijdit3GO23sd Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org This just replaces a while loop with list_for_each_entry_safe() in __rbd_remove_all_snaps(). Signed-off-by: Alex Elder --- drivers/block/rbd.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index b9895fe..74e6a33 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c @@ -1692,11 +1692,10 @@ bad: static void __rbd_remove_all_snaps(struct rbd_device *rbd_dev) { struct rbd_snap *snap; + struct rbd_snap *next; - while (!list_empty(&rbd_dev->snaps)) { - snap = list_first_entry(&rbd_dev->snaps, struct rbd_snap, node); + list_for_each_entry_safe(snap, next, &rbd_dev->snaps, node) __rbd_remove_snap_dev(rbd_dev, snap); - } } /*