From patchwork Thu Mar 26 17:33:52 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Snitzer X-Patchwork-Id: 14583 X-Patchwork-Delegate: agk@redhat.com Received: from hormel.redhat.com (hormel1.redhat.com [209.132.177.33]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n2QHXwMp010180 for ; Thu, 26 Mar 2009 17:33:59 GMT Received: from listman.util.phx.redhat.com (listman.util.phx.redhat.com [10.8.4.110]) by hormel.redhat.com (Postfix) with ESMTP id 0398061910D; Thu, 26 Mar 2009 13:33:58 -0400 (EDT) Received: from int-mx2.corp.redhat.com (nat-pool.util.phx.redhat.com [10.8.5.200]) by listman.util.phx.redhat.com (8.13.1/8.13.1) with ESMTP id n2QHXub2013966 for ; Thu, 26 Mar 2009 13:33:56 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n2QHXm8n031093 for ; Thu, 26 Mar 2009 13:33:48 -0400 Received: from localhost (dhcp-100-19-145.bos.redhat.com [10.16.19.145]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n2QHXsGx010055 for ; Thu, 26 Mar 2009 13:33:55 -0400 From: Mike Snitzer To: dm-devel@redhat.com Date: Thu, 26 Mar 2009 13:33:52 -0400 Message-Id: <1238088833-9447-1-git-send-email-snitzer@redhat.com> X-Scanned-By: MIMEDefang 2.58 on 172.16.27.26 X-loop: dm-devel@redhat.com Subject: [dm-devel] [PATCH 1/2] dm log: use standard kernel module refcounts X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.5 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 Avoid private module usage accounting by removing 'use' from dm_dirty_log_internal. The standard module reference counting is sufficient. Signed-off-by: Mike Snitzer --- drivers/md/dm-log.c | 19 +++---------------- 1 files changed, 3 insertions(+), 16 deletions(-) diff --git a/drivers/md/dm-log.c b/drivers/md/dm-log.c index 737961f..094c8f0 100644 --- a/drivers/md/dm-log.c +++ b/drivers/md/dm-log.c @@ -20,7 +20,6 @@ struct dm_dirty_log_internal { struct dm_dirty_log_type *type; struct list_head list; - long use; }; static LIST_HEAD(_log_types); @@ -44,12 +43,8 @@ static struct dm_dirty_log_internal *_get_dirty_log_type(const char *name) spin_lock(&_lock); log_type = __find_dirty_log_type(name); - if (log_type) { - if (!log_type->use && !try_module_get(log_type->type->module)) - log_type = NULL; - else - log_type->use++; - } + if (log_type && !try_module_get(log_type->type->module)) + log_type = NULL; spin_unlock(&_lock); @@ -120,10 +115,7 @@ static void put_type(struct dm_dirty_log_type *type) if (!log_type) goto out; - if (!--log_type->use) - module_put(type->module); - - BUG_ON(log_type->use < 0); + module_put(type->module); out: spin_unlock(&_lock); @@ -173,11 +165,6 @@ int dm_dirty_log_type_unregister(struct dm_dirty_log_type *type) return -EINVAL; } - if (log_type->use) { - spin_unlock(&_lock); - return -ETXTBSY; - } - list_del(&log_type->list); spin_unlock(&_lock);