From patchwork Tue Nov 4 17:54:37 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vivek Goyal X-Patchwork-Id: 5230421 Return-Path: X-Original-To: patchwork-dm-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 9F4FF9F349 for ; Tue, 4 Nov 2014 17:59:18 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BCF8D2012F for ; Tue, 4 Nov 2014 17:59:17 +0000 (UTC) Received: from mx5-phx2.redhat.com (mx5-phx2.redhat.com [209.132.183.37]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BCE1D20120 for ; Tue, 4 Nov 2014 17:59:16 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx5-phx2.redhat.com (8.14.4/8.14.4) with ESMTP id sA4HsdDh012003; Tue, 4 Nov 2014 12:54:41 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id sA4HsbLs011767 for ; Tue, 4 Nov 2014 12:54:37 -0500 Received: from localhost.localdomain ([10.18.17.2]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id sA4HsbSO016371; Tue, 4 Nov 2014 12:54:37 -0500 Received: by localhost.localdomain (Postfix, from userid 10451) id 23D86201200; Tue, 4 Nov 2014 12:54:37 -0500 (EST) Date: Tue, 4 Nov 2014 12:54:37 -0500 From: Vivek Goyal To: device-mapper development Message-ID: <20141104175437.GA14026@redhat.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-loop: dm-devel@redhat.com Cc: Mike Snitzer Subject: [dm-devel] [PATCH] dm-thin: Change couple of DMWARN() to pr_debug() X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk Reply-To: device-mapper development List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Right now we use DMWARN to output a message on console if thin/snap device creation fails. It has two problems. - First of all this is not a warning and an error. In case of error, just returning code to user space should be good enough. If we need some debug info out, then a better choice will be pr_debug() which can be enabled when the need be. - dm-thin expects users to keep track of already used device id. If an application tries to reuse the id, then -EEXIST is returned but this message is also displayed on console. [17991.140135] device-mapper: thin: Creation of new snapshot 33 of device 3 failed Docker does not keep track of already used device ids. Instead it starts from 0 and keeps on incrementing this id and retrying till it succeeds. And that leads to flooding console with above messages. I think it is better to just return error code to user space and not give any warning. Instead convert this into pr_debug() so that if need be one can enable it dynamically using debugfs and get some debug data out on a running system. One can enable all pr_debug() in dm-thin.c file using following. echo 'file dm-thin.c +p' > /sys/kernel/debug/dynamic_debug/control Signed-off-by: Vivek Goyal --- drivers/md/dm-thin.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) -- dm-devel mailing list dm-devel@redhat.com https://www.redhat.com/mailman/listinfo/dm-devel Index: linux-2.6/drivers/md/dm-thin.c =================================================================== --- linux-2.6.orig/drivers/md/dm-thin.c 2014-11-04 10:05:43.504600136 -0500 +++ linux-2.6/drivers/md/dm-thin.c 2014-11-04 10:15:48.984908908 -0500 @@ -4,6 +4,8 @@ * This file is released under the GPL. */ +#define pr_fmt(fmt) "device-mapper: thin: " fmt + #include "dm-thin-metadata.h" #include "dm-bio-prison.h" #include "dm.h" @@ -2819,7 +2821,7 @@ static int process_create_thin_mesg(unsi r = dm_pool_create_thin(pool->pmd, dev_id); if (r) { - DMWARN("Creation of new thinly-provisioned device with id %s failed.", + pr_debug("Creation of new thinly-provisioned device with id %s failed.", argv[1]); return r; } @@ -2847,7 +2849,7 @@ static int process_create_snap_mesg(unsi r = dm_pool_create_snap(pool->pmd, dev_id, origin_dev_id); if (r) { - DMWARN("Creation of new snapshot %s of device %s failed.", + pr_debug("Creation of new snapshot %s of device %s failed.", argv[1], argv[2]); return r; }