Received: with ECARTIS (v1.0.0; list linux-xfs); Fri, 22 Aug 2003 13:11:16 -0700 (PDT) Received: from zero.aec.at (Jared.Macphester@zero.aec.at [193.170.194.10]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h7MKAFoO023827 for ; Fri, 22 Aug 2003 13:10:56 -0700 Received: from fred.muc.de (Joel.Buxter@localhost.localdomain [127.0.0.1]) by zero.aec.at (8.11.6/8.11.2) with ESMTP id h7MKA8m01121 for ; Fri, 22 Aug 2003 22:10:08 +0200 Received: by fred.muc.de (Postfix on SuSE Linux 7.3 (i386), from userid 500) id 129C85BBBF; Fri, 22 Aug 2003 22:10:13 +0200 (CEST) Date: Fri, 22 Aug 2003 22:10:13 +0200 From: Andi Kleen To: linux-xfs@oss.sgi.com Subject: [PATCH] One more bugfix for xfs_lowbit64 Message-ID: <20030822201012.GA19026@averell> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4i X-archive-position: 158 X-ecartis-version: Ecartis v1.0.0 Sender: linux-xfs-bounce@oss.sgi.com Errors-to: linux-xfs-bounce@oss.sgi.com X-original-sender: ak@muc.de Precedence: bulk X-list: linux-xfs Content-Length: 583 Lines: 27 (mea culpa). The error return was broken too, it would return -2, not -1 for errors. Makes no difference in the callers, they never check for -1, but is still better to conform to the spec. Includes the previous fix for bits > 32. -Andi --- linux-2.6.0test3/fs/xfs/xfs_bit.c-o 2003-05-27 03:00:41.000000000 +0200 +++ linux-2.6.0test3/fs/xfs/xfs_bit.c 2003-08-22 22:08:14.000000000 +0200 @@ -156,12 +156,12 @@ { int n; n = ffs((unsigned)v); - if (n == 0) { + if (n < 0) { n = ffs(v >> 32); if (n >= 0) n+=32; } - return n-1; + return (n < 0) ? n : n-1; } /*