From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964819AbVLVMAy (ORCPT ); Thu, 22 Dec 2005 07:00:54 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S964824AbVLVMAy (ORCPT ); Thu, 22 Dec 2005 07:00:54 -0500 Received: from pentafluge.infradead.org ([213.146.154.40]:18060 "EHLO pentafluge.infradead.org") by vger.kernel.org with ESMTP id S964819AbVLVMAx (ORCPT ); Thu, 22 Dec 2005 07:00:53 -0500 Date: Thu, 22 Dec 2005 12:00:52 +0000 From: Christoph Hellwig To: Ingo Molnar Cc: lkml , Linus Torvalds , Andrew Morton , Arjan van de Ven , Nicolas Pitre , Jes Sorensen , Zwane Mwaikambo , Oleg Nesterov , David Howells , Alan Cox , Benjamin LaHaise , Steven Rostedt , Christoph Hellwig , Andi Kleen , Russell King Subject: Re: [patch 9/9] mutex subsystem, XFS namespace collision fixes Message-ID: <20051222120052.GC30964@infradead.org> Mail-Followup-To: Christoph Hellwig , Ingo Molnar , lkml , Linus Torvalds , Andrew Morton , Arjan van de Ven , Nicolas Pitre , Jes Sorensen , Zwane Mwaikambo , Oleg Nesterov , David Howells , Alan Cox , Benjamin LaHaise , Steven Rostedt , Andi Kleen , Russell King References: <20051222114308.GJ18878@elte.hu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20051222114308.GJ18878@elte.hu> User-Agent: Mutt/1.4.2.1i X-SRS-Rewrite: SMTP reverse-path rewritten from by pentafluge.infradead.org See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org > -#define mutex_init(lock, type, name) sema_init(lock, 1) > -#define mutex_destroy(lock) sema_init(lock, -99) > -#define mutex_lock(lock, num) down(lock) > -#define mutex_trylock(lock) (down_trylock(lock) ? 0 : 1) > -#define mutex_unlock(lock) up(lock) > +#define xfs_mutex_init(lock, type, name) sema_init(lock, 1) > +#define xfs_mutex_destroy(lock) sema_init(lock, -99) > +#define xfs_mutex_lock(lock, num) down(lock) > +#define xfs_mutex_trylock(lock) (down_trylock(lock) ? 0 : 1) > +#define xfs_mutex_unlock(lock) up(lock) Again, this should really be using the mutex primitives (obviously ;-)). The patch should become (pseudo-patch): -typedef struct semaphore mutex_t - -#define mutex_init(lock, type, name) sema_init(lock, 1) -#define mutex_destroy(lock) sema_init(lock, -99) -#define mutex_lock(lock, num) down(lock) -#define mutex_trylock(lock) (down_trylock(lock) ? 0 : 1) -#define mutex_unlock(lock) up(lock) +#define mutex_init(lock, type, name) mutex_init(lock) +#define mutex_destroy(lock) do { } while (0) While we're at it, maybe we should a mutex_destroy aswell? it would be non-mandatory and allow that a lock is gone for the debugging variant.