From owner-freebsd-fs@FreeBSD.ORG Wed Feb 23 16:48:49 2011 Return-Path: Delivered-To: fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 14BE81065670 for ; Wed, 23 Feb 2011 16:48:49 +0000 (UTC) (envelope-from gnehzuil@gmail.com) Received: from mail-yi0-f54.google.com (mail-yi0-f54.google.com [209.85.218.54]) by mx1.freebsd.org (Postfix) with ESMTP id C45918FC13 for ; Wed, 23 Feb 2011 16:48:48 +0000 (UTC) Received: by yib19 with SMTP id 19so186908yib.13 for ; Wed, 23 Feb 2011 08:48:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=e35h/fdktp7J6WVJarRo0vbK6x0oUwXcjXgHuf6TXPg=; b=LFLR1xYNvoaESfw6lVxW9cULHpj0b/ZZGB5YFRxlaGpQB6yB7M/R7k5zJqFbgPi4V+ HsSbKmVP9wU57K2Tzxqgr7ZBJDYA4b/37GqOPIDaF+enzmnc5sV2Dl+/TCXKoLJkHEFm mpJBoJRTpnhX00ebGO8/Qfz92pu3ysRzN8GvE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=lOpCatqk3OqSJr13UUAYRc0z+rpK0ivznn66wAKhGIQZdtuKyGjN8k3OBqiXxOeWHJ VFxo3za/mMhUHOV9vH3zvXNoC0L62tY3ZocCzoteXX6cfCzvZSf20ZIN4gsMTPNkt76R i30Qd51AXN+S/6x3F0E3VYwkBHYfBTIPyBCbQ= MIME-Version: 1.0 Received: by 10.236.109.51 with SMTP id r39mr2111429yhg.66.1298478933960; Wed, 23 Feb 2011 08:35:33 -0800 (PST) Received: by 10.147.167.13 with HTTP; Wed, 23 Feb 2011 08:35:33 -0800 (PST) In-Reply-To: <201102230811.32864.jhb@freebsd.org> References: <201102230811.32864.jhb@freebsd.org> Date: Thu, 24 Feb 2011 00:35:33 +0800 Message-ID: From: gnehzuil gnehzuil To: John Baldwin Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: "Pedro F. Giffuni" , fs@freebsd.org Subject: Re: Simple ext2fs allocation routine cleanups X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Feb 2011 16:48:49 -0000 Hi John, I use dbench program to do some tests for your changes. However, it causes kernel crash. The error is as follows: panic: __lockmgr_args: recursing on non recursive lockmgr ext2fs @ /usr/src/sys/kern/vfs_subr.c:2124 Best regards, lz 2011/2/23 John Baldwin > I have some small changes to ext2fs to use ffs() to simplify some of the > allocation routines. The changes compile, but I have not had time to > generate > a test ext2fs file system to run-test them. If someone has some spare > cycles > to setup a test file system and try them out I would appreciate it. > Otherwise > I will get to it eventually. Given that this hasn't been run-tested yet, I > would not recommend using it for a production ext2fs since it may > completely > trash the filesystem. > > Index: ext2_alloc.c > =================================================================== > --- ext2_alloc.c (revision 218951) > +++ ext2_alloc.c (working copy) > @@ -815,16 +815,12 @@ > } > } > i = start + len - loc; > - map = ibp[i]; > - ipref = i * NBBY; > - for (i = 1; i < (1 << NBBY); i <<= 1, ipref++) { > - if ((map & i) == 0) { > - goto gotit; > - } > + map = ibp[i] ^ 0xff; > + if (map == 0) { > + printf("fs = %s\n", fs->e2fs_fsmnt); > + panic("ext2fs_nodealloccg: block not in map"); > } > - printf("fs = %s\n", fs->e2fs_fsmnt); > - panic("ext2fs_nodealloccg: block not in map"); > - /* NOTREACHED */ > + ipref = i * NBBY + ffs(map); > gotit: > setbit(ibp, ipref); > EXT2_LOCK(ump); > @@ -952,7 +948,6 @@ > static daddr_t > ext2_mapsearch(struct m_ext2fs *fs, char *bbp, daddr_t bpref) > { > - daddr_t bno; > int start, len, loc, i, map; > > /* > @@ -977,15 +972,12 @@ > } > } > i = start + len - loc; > - map = bbp[i]; > - bno = i * NBBY; > - for (i = 1; i < (1 << NBBY); i <<= 1, bno++) { > - if ((map & i) == 0) > - return (bno); > + map = bbp[i] ^ 0xff; > + if (map == 0) { > + printf("fs = %s\n", fs->e2fs_fsmnt); > + panic("ext2fs_mapsearch: block not in map"); > } > - printf("fs = %s\n", fs->e2fs_fsmnt); > - panic("ext2fs_mapsearch: block not in map"); > - /* NOTREACHED */ > + return (i * NBBY + ffs(map)); > } > > /* > > -- > John Baldwin > _______________________________________________ > freebsd-fs@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-fs > To unsubscribe, send any mail to "freebsd-fs-unsubscribe@freebsd.org" > -- Liu Zheng gnehzuil@gmail.com CNU NetLab Tsinghua CSCW