From owner-freebsd-fs@FreeBSD.ORG Sun Apr 26 09:21:13 2009 Return-Path: Delivered-To: freebsd-fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6D6A5106564A for ; Sun, 26 Apr 2009 09:21:13 +0000 (UTC) (envelope-from scott@bqinternet.com) Received: from mail.bqinternet.com (mail.bqinternet.com [69.9.32.203]) by mx1.freebsd.org (Postfix) with ESMTP id 39FB68FC12 for ; Sun, 26 Apr 2009 09:21:13 +0000 (UTC) (envelope-from scott@bqinternet.com) Received: from localhost (mail [69.9.32.203]) by mail.bqinternet.com (Postfix) with ESMTP id 168AB409A31; Sun, 26 Apr 2009 09:21:14 +0000 (GMT) Received: from mail.bqinternet.com ([69.9.32.203]) by localhost (mail.bqinternet.com [69.9.32.203]) (amavisd-new, port 10024) with ESMTP id Z9UbeP6fWjyH; Sun, 26 Apr 2009 09:21:13 +0000 (GMT) Received: from scott-burnss-macbook-air.local (mail [69.9.32.203]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.bqinternet.com (Postfix) with ESMTP id 3973D409A28; Sun, 26 Apr 2009 09:21:13 +0000 (GMT) Message-ID: <49F42786.6070008@bqinternet.com> Date: Sun, 26 Apr 2009 05:21:10 -0400 From: Scott Burns User-Agent: Thunderbird 2.0.0.21 (Macintosh/20090302) MIME-Version: 1.0 To: Ivan Voras References: <49F048FB.6000401@bqinternet.com> <20090423195335.521db0a7@kan.dnsalias.net> <49F16009.3080206@bqinternet.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-fs@freebsd.org Subject: Re: UFS2 metadata checksums 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: Sun, 26 Apr 2009 09:21:13 -0000 Ivan Voras wrote: > Scott Burns wrote: > >> As long as there is some interest in this kind of functionality, I will >> continue working on it. The next step is to protect metadata structures >> beyond inodes. I am hoping to have some results to post in the next few >> weeks. > > Btw. what checksum do you use? I haven't settled on anything yet. Currently I'm just reading the dinode structure 32 bits at a time and doing a bitwise XOR. It's just a proof of concept and I am open to suggestions. -- Scott Burns System Administrator BQ Internet Corporation From owner-freebsd-fs@FreeBSD.ORG Sun Apr 26 20:49:06 2009 Return-Path: Delivered-To: freebsd-fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E86511065672 for ; Sun, 26 Apr 2009 20:49:06 +0000 (UTC) (envelope-from rmacklem@uoguelph.ca) Received: from skerryvore.cs.uoguelph.ca (skerryvore.cs.uoguelph.ca [131.104.94.204]) by mx1.freebsd.org (Postfix) with ESMTP id 916248FC1D for ; Sun, 26 Apr 2009 20:49:06 +0000 (UTC) (envelope-from rmacklem@uoguelph.ca) Received: from muncher.cs.uoguelph.ca (muncher.cs.uoguelph.ca [131.104.91.102]) by skerryvore.cs.uoguelph.ca (8.13.1/8.13.1) with ESMTP id n3QKn5dR018851 for ; Sun, 26 Apr 2009 16:49:05 -0400 Received: from localhost (rmacklem@localhost) by muncher.cs.uoguelph.ca (8.11.7p3+Sun/8.11.6) with ESMTP id n3QKu3I04619 for ; Sun, 26 Apr 2009 16:56:03 -0400 (EDT) X-Authentication-Warning: muncher.cs.uoguelph.ca: rmacklem owned process doing -bs Date: Sun, 26 Apr 2009 16:56:03 -0400 (EDT) From: Rick Macklem X-X-Sender: rmacklem@muncher.cs.uoguelph.ca To: freebsd-fs@freebsd.org Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Scanned-By: MIMEDefang 2.63 on 131.104.94.221 Subject: Why do some ufs i-node fields have 2 copies? 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: Sun, 26 Apr 2009 20:49:07 -0000 Hi, I was just wondering if anyone conversant with ufs/ffs could tell me why the following fields of the i-node have off-disk and on-disk copies? (One thought I had was that these fields are sometimes set to values that shouldn't get saved on-disk, but it was just a hunch.) /* * Copies from the on-disk dinode itself. */ u_int16_t i_mode; /* IFMT, permissions; see below. */ int16_t i_nlink; /* File link count. */ u_int64_t i_size; /* File byte count. */ u_int32_t i_flags; /* Status flags (chflags). */ int64_t i_gen; /* Generation number. */ u_int32_t i_uid; /* File owner. */ u_int32_t i_gid; /* File group. */ /* * The real copy of the on-disk inode. Thanks in advance for any info, rick From owner-freebsd-fs@FreeBSD.ORG Sun Apr 26 21:30:24 2009 Return-Path: Delivered-To: freebsd-fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 82BB6106564A for ; Sun, 26 Apr 2009 21:30:24 +0000 (UTC) (envelope-from rick@kiwi-computer.com) Received: from kiwi-computer.com (keira.kiwi-computer.com [63.224.10.3]) by mx1.freebsd.org (Postfix) with SMTP id 16CBA8FC0C for ; Sun, 26 Apr 2009 21:30:23 +0000 (UTC) (envelope-from rick@kiwi-computer.com) Received: (qmail 51951 invoked by uid 2001); 26 Apr 2009 21:03:43 -0000 Date: Sun, 26 Apr 2009 16:03:43 -0500 From: "Rick C. Petty" To: Rick Macklem Message-ID: <20090426210343.GA51829@keira.kiwi-computer.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i Cc: freebsd-fs@freebsd.org Subject: Re: Why do some ufs i-node fields have 2 copies? X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: rick-freebsd2008@kiwi-computer.com List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Apr 2009 21:30:24 -0000 On Sun, Apr 26, 2009 at 04:56:03PM -0400, Rick Macklem wrote: > > I was just wondering if anyone conversant with ufs/ffs could tell me why > the following fields of the i-node have off-disk and on-disk copies? > (One thought I had was that these fields are sometimes set to values > that shouldn't get saved on-disk, but it was just a hunch.) > /* > * Copies from the on-disk dinode itself. > */ > u_int16_t i_mode; /* IFMT, permissions; see below. */ > int16_t i_nlink; /* File link count. */ > u_int64_t i_size; /* File byte count. */ > u_int32_t i_flags; /* Status flags (chflags). */ > int64_t i_gen; /* Generation number. */ > u_int32_t i_uid; /* File owner. */ > u_int32_t i_gid; /* File group. */ > /* > * The real copy of the on-disk inode. You missed a few lines: union { struct ufs1_dinode *din1; /* UFS1 on-disk dinode. */ struct ufs2_dinode *din2; /* UFS2 on-disk dinode. */ } dinode_u; The reason is that the first set (the "copies") are what are referenced by the ffs/ufs code. The real copies are what came from the disk (hence the "on-disk"). Because UFS1 & UFS2 have such different dinode structures, the copies are moved to/from the dinode structures when the inode is read to or written from the disk. At all other times, the "copies" are used. -- Rick C. Petty From owner-freebsd-fs@FreeBSD.ORG Sun Apr 26 22:19:19 2009 Return-Path: Delivered-To: freebsd-fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EDD941065670 for ; Sun, 26 Apr 2009 22:19:19 +0000 (UTC) (envelope-from rmacklem@uoguelph.ca) Received: from gigi.cs.uoguelph.ca (gigi.cs.uoguelph.ca [131.104.94.210]) by mx1.freebsd.org (Postfix) with ESMTP id ABE728FC1B for ; Sun, 26 Apr 2009 22:19:19 +0000 (UTC) (envelope-from rmacklem@uoguelph.ca) Received: from muncher.cs.uoguelph.ca (muncher.cs.uoguelph.ca [131.104.91.102]) by gigi.cs.uoguelph.ca (8.13.1/8.13.1) with ESMTP id n3QMJIMK026504; Sun, 26 Apr 2009 18:19:18 -0400 Received: from localhost (rmacklem@localhost) by muncher.cs.uoguelph.ca (8.11.7p3+Sun/8.11.6) with ESMTP id n3QMQEP18311; Sun, 26 Apr 2009 18:26:16 -0400 (EDT) X-Authentication-Warning: muncher.cs.uoguelph.ca: rmacklem owned process doing -bs Date: Sun, 26 Apr 2009 18:26:14 -0400 (EDT) From: Rick Macklem X-X-Sender: rmacklem@muncher.cs.uoguelph.ca To: "Rick C. Petty" In-Reply-To: <20090426210343.GA51829@keira.kiwi-computer.com> Message-ID: References: <20090426210343.GA51829@keira.kiwi-computer.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Scanned-By: MIMEDefang 2.63 on 131.104.94.210 Cc: freebsd-fs@freebsd.org Subject: Re: Why do some ufs i-node fields have 2 copies? 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: Sun, 26 Apr 2009 22:19:20 -0000 On Sun, 26 Apr 2009, Rick C. Petty wrote: > > The reason is that the first set (the "copies") are what are referenced by > the ffs/ufs code. The real copies are what came from the disk (hence the > "on-disk"). Because UFS1 & UFS2 have such different dinode structures, the > copies are moved to/from the dinode structures when the inode is read to or > written from the disk. At all other times, the "copies" are used. > Righto. However some fields like i_mtime are just accessed using the DIP() and DIP_SET() macros. Are you just saying that it was easier to not bother using the macros for frequently referenced fields? (Or, to put it another way, "when support for UFS2 was added, the code would have looked really grotty if DIP() and DIP_SET() were used for frequently used fields?".) The question came up because I had proposed a patch with: DIP_SET(ip, i_modrev, DIP(ip, i_modrev) + 1); in it and it was suggested that i_modrev might be more appropriate with a "shadow copy". Since I realized I didn't know why there were "shadow copies" of some fields and not others, it lead to the original question. (This is the only place i_modrev gets manipulated by the patch.) If my interpretation of your answer is correct, I'd say that a "shadow copy" doesn't really add anything to the code? What do others think? Thanks for the reply, rick From owner-freebsd-fs@FreeBSD.ORG Mon Apr 27 11:06:53 2009 Return-Path: Delivered-To: freebsd-fs@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D069C1065670 for ; Mon, 27 Apr 2009 11:06:53 +0000 (UTC) (envelope-from owner-bugmaster@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id BCFC78FC14 for ; Mon, 27 Apr 2009 11:06:53 +0000 (UTC) (envelope-from owner-bugmaster@FreeBSD.org) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id n3RB6r3d002270 for ; Mon, 27 Apr 2009 11:06:53 GMT (envelope-from owner-bugmaster@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.3/8.14.3/Submit) id n3RB6rPq002266 for freebsd-fs@FreeBSD.org; Mon, 27 Apr 2009 11:06:53 GMT (envelope-from owner-bugmaster@FreeBSD.org) Date: Mon, 27 Apr 2009 11:06:53 GMT Message-Id: <200904271106.n3RB6rPq002266@freefall.freebsd.org> X-Authentication-Warning: freefall.freebsd.org: gnats set sender to owner-bugmaster@FreeBSD.org using -f From: FreeBSD bugmaster To: freebsd-fs@FreeBSD.org Cc: Subject: Current problem reports assigned to freebsd-fs@FreeBSD.org 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: Mon, 27 Apr 2009 11:06:54 -0000 Note: to view an individual PR, use: http://www.freebsd.org/cgi/query-pr.cgi?pr=(number). The following is a listing of current problems submitted by FreeBSD users. These represent problem reports covering all versions including experimental development code and obsolete releases. S Tracker Resp. Description -------------------------------------------------------------------------------- o kern/133676 fs [smbfs] [panic] umount -f'ing a vnode-based memory dis o kern/133614 fs [smbfs] [panic] panic: ffs_truncate: read-only filesys o kern/133373 fs [zfs] umass attachment causes ZFS checksum errors, dat o kern/133174 fs [msdosfs] [patch] msdosfs must support utf-encoded int o kern/133150 fs [zfs] Page fault with ZFS on 7.1-RELEASE/amd64 while w o kern/133134 fs [zfs] Missing ZFS zpool labels o kern/132960 fs [ufs] [panic] panic:ffs_blkfree: freeing free frag o kern/132597 fs [tmpfs] [panic] tmpfs-related panic while interrupting o kern/132551 fs [zfs] ZFS locks up on extattr_list_link syscall o kern/132397 fs reboot causes filesystem corruption (failure to sync b o kern/132337 fs [zfs] [panic] kernel panic in zfs_fuid_create_cred o kern/132331 fs [ufs] [lor] LOR ufs and syncer o kern/132145 fs [panic] File System Hard Crashes f kern/132068 fs [zfs] page fault when using ZFS over NFS on 7.1-RELEAS o kern/131995 fs [nfs] Failure to mount NFSv4 server o kern/131360 fs [nfs] poor scaling behavior of the NFS server under lo o kern/131342 fs [nfs] mounting/unmounting of disks causes NFS to fail o bin/131341 fs makefs: error "Bad file descriptor" on the mount poin o kern/131086 fs [ext2fs] [patch] mkfs.ext2 creates rotten partition o kern/131084 fs [xfs] xfs destroys itself after copying data o kern/131081 fs [zfs] User cannot delete a file when a ZFS dataset is o kern/130979 fs [smbfs] [panic] boot/kernel/smbfs.ko o kern/130920 fs [msdosfs] cp(1) takes 100% CPU time while copying file o kern/130229 fs [iconv] usermount fails on fs that need iconv o kern/130210 fs [nullfs] Error by check nullfs o bin/130105 fs [zfs] zfs send -R dumps core o kern/129760 fs [nfs] after 'umount -f' of a stale NFS share FreeBSD l o kern/129231 fs [ufs] [patch] New UFS mount (norandom) option - mostly o kern/129152 fs [panic] non-userfriendly panic when trying to mount(8) f kern/128829 fs smbd(8) causes periodic panic on 7-RELEASE o kern/128633 fs [zfs] [lor] lock order reversal in zfs o kern/128514 fs [zfs] [mpt] problems with ZFS and LSILogic SAS/SATA Ad f kern/128173 fs [ext2fs] ls gives "Input/output error" on mounted ext3 o kern/127420 fs [gjournal] [panic] Journal overflow on gmirrored gjour o kern/127213 fs [tmpfs] sendfile on tmpfs data corruption o kern/127029 fs [panic] mount(8): trying to mount a write protected zi o kern/126287 fs [ufs] [panic] Kernel panics while mounting an UFS file f kern/125536 fs [ext2fs] ext 2 mounts cleanly but fails on commands li o kern/125149 fs [nfs] [panic] changing into .zfs dir from nfs client c f kern/124621 fs [ext3] [patch] Cannot mount ext2fs partition o kern/122888 fs [zfs] zfs hang w/ prefetch on, zil off while running t o bin/122172 fs [fs]: amd(8) automount daemon dies on 6.3-STABLE i386, o bin/121072 fs [smbfs] mount_smbfs(8) cannot normally convert the cha o bin/118249 fs mv(1): moving a directory changes its mtime o kern/116170 fs [panic] Kernel panic when mounting /tmp o kern/114955 fs [cd9660] [patch] [request] support for mask,dirmask,ui o kern/114847 fs [ntfs] [patch] [request] dirmask support for NTFS ala o kern/114676 fs [ufs] snapshot creation panics: snapacct_ufs2: bad blo o bin/114468 fs [patch] [request] add -d option to umount(8) to detach o bin/113838 fs [patch] [request] mount(8): add support for relative p o bin/113049 fs [patch] [request] make quot(8) use getopt(3) and show o kern/112658 fs [smbfs] [patch] smbfs and caching problems (resolves b o kern/94769 fs [ufs] Multiple file deletions on multi-snapshotted fil o kern/93942 fs [vfs] [patch] panic: ufs_dirbad: bad dir (patch from D o kern/92272 fs [ffs] [hang] Filling a filesystem while creating a sna o kern/89991 fs [ufs] softupdates with mount -ur causes fs UNREFS o kern/68978 fs [panic] [ufs] crashes with failing hard disk, loose po o kern/65920 fs [nwfs] Mounted Netware filesystem behaves strange o kern/51685 fs [hang] Unbounded inode allocation causes kernel to loc 59 problems total. From owner-freebsd-fs@FreeBSD.ORG Mon Apr 27 11:23:59 2009 Return-Path: Delivered-To: freebsd-fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DF554106564A for ; Mon, 27 Apr 2009 11:23:59 +0000 (UTC) (envelope-from freebsd-fs@m.gmane.org) Received: from ciao.gmane.org (main.gmane.org [80.91.229.2]) by mx1.freebsd.org (Postfix) with ESMTP id 680408FC15 for ; Mon, 27 Apr 2009 11:23:59 +0000 (UTC) (envelope-from freebsd-fs@m.gmane.org) Received: from list by ciao.gmane.org with local (Exim 4.43) id 1LyOwE-0001K3-CJ for freebsd-fs@freebsd.org; Mon, 27 Apr 2009 11:23:54 +0000 Received: from lara.cc.fer.hr ([161.53.72.113]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 27 Apr 2009 11:23:54 +0000 Received: from ivoras by lara.cc.fer.hr with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 27 Apr 2009 11:23:54 +0000 X-Injected-Via-Gmane: http://gmane.org/ To: freebsd-fs@freebsd.org From: Ivan Voras Date: Mon, 27 Apr 2009 13:23:39 +0200 Lines: 48 Message-ID: References: <49F048FB.6000401@bqinternet.com> <20090423195335.521db0a7@kan.dnsalias.net> <49F16009.3080206@bqinternet.com> <49F42786.6070008@bqinternet.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig846BEF3A81E86FCB5A3D385C" X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: lara.cc.fer.hr User-Agent: Thunderbird 2.0.0.21 (X11/20090318) In-Reply-To: <49F42786.6070008@bqinternet.com> X-Enigmail-Version: 0.95.0 Sender: news Subject: Re: UFS2 metadata checksums 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: Mon, 27 Apr 2009 11:24:00 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig846BEF3A81E86FCB5A3D385C Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Scott Burns wrote: > Ivan Voras wrote: >> Scott Burns wrote: >> >>> As long as there is some interest in this kind of functionality, I wi= ll >>> continue working on it. The next step is to protect metadata structu= res >>> beyond inodes. I am hoping to have some results to post in the next = few >>> weeks. >> >> Btw. what checksum do you use? >=20 > I haven't settled on anything yet. Currently I'm just reading the > dinode structure 32 bits at a time and doing a bitwise XOR. It's just = a > proof of concept and I am open to suggestions. For 32 bits of hash, adler32 or crc32 should be ok - the code is already used in the system for various purposes. Adler32 is faster; for a sample implementation see sys/net/zlib.c at line 5357. ZFS defaults to "fletcher2" (I guess 16-bit Fletcher?) which should be faster but its implementation could be a bit problematic (see http://opensolaris.org/jive/thread.jspa?threadID=3D69655&tstart=3D0). --------------enig846BEF3A81E86FCB5A3D385C Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFJ9ZXCldnAQVacBcgRAsARAJ0RFwItqrsPcC5+jKVs4LnJeHV9PACeKMzy dvgDWFrhWQ7U8NWRjLMyEWo= =lFbm -----END PGP SIGNATURE----- --------------enig846BEF3A81E86FCB5A3D385C-- From owner-freebsd-fs@FreeBSD.ORG Mon Apr 27 13:52:02 2009 Return-Path: Delivered-To: freebsd-fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 13625106566B for ; Mon, 27 Apr 2009 13:52:02 +0000 (UTC) (envelope-from rick@kiwi-computer.com) Received: from kiwi-computer.com (keira.kiwi-computer.com [63.224.10.3]) by mx1.freebsd.org (Postfix) with SMTP id A8F438FC12 for ; Mon, 27 Apr 2009 13:52:01 +0000 (UTC) (envelope-from rick@kiwi-computer.com) Received: (qmail 59296 invoked by uid 2001); 27 Apr 2009 13:52:01 -0000 Date: Mon, 27 Apr 2009 08:52:00 -0500 From: "Rick C. Petty" To: Rick Macklem Message-ID: <20090427135200.GA59201@keira.kiwi-computer.com> References: <20090426210343.GA51829@keira.kiwi-computer.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i Cc: freebsd-fs@freebsd.org Subject: Re: Why do some ufs i-node fields have 2 copies? X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: rick-freebsd2008@kiwi-computer.com List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Apr 2009 13:52:02 -0000 On Sun, Apr 26, 2009 at 06:26:14PM -0400, Rick Macklem wrote: > > > >The reason is that the first set (the "copies") are what are referenced by > >the ffs/ufs code. The real copies are what came from the disk (hence the > >"on-disk"). Because UFS1 & UFS2 have such different dinode structures, the > >copies are moved to/from the dinode structures when the inode is read to or > >written from the disk. At all other times, the "copies" are used. > > > Righto. However some fields like i_mtime are just accessed using the > DIP() and DIP_SET() macros. > > Are you just saying that it was easier to not bother using the macros for > frequently referenced fields? (Or, to put it another way, "when support > for UFS2 was added, the code would have looked really grotty if DIP() and > DIP_SET() were used for frequently used fields?".) No, it is silly to chase up the link to the superblock just to check for the UFS version for every single access to these items. Instead, all accesses should be made to the copies *except* the ones which assemble the dinode and store (or load) to disk. In those cases, you already have to access other items in the superblock of the cylinder group. > The question came up because I had proposed a patch with: > > DIP_SET(ip, i_modrev, DIP(ip, i_modrev) + 1); > > in it and it was suggested that i_modrev might be more appropriate with > a "shadow copy". Since I realized I didn't know why there were "shadow > copies" of some fields and not others, it lead to the original question. > (This is the only place i_modrev gets manipulated by the patch.) Yes, it would be. > If my interpretation of your answer is correct, I'd say that a "shadow > copy" doesn't really add anything to the code? What do others think? It adds plenty-- you don't have to dereference more than the inode pointer. If you don't use the shadows, you have to dereference the superblock (i_fs) to get the UFS version as well as dereference the dinode itself. It doesn't make sense to change all the macros to not use the shadows. -- Rick C. Petty From owner-freebsd-fs@FreeBSD.ORG Mon Apr 27 14:51:45 2009 Return-Path: Delivered-To: freebsd-fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8DFE11065675 for ; Mon, 27 Apr 2009 14:51:45 +0000 (UTC) (envelope-from rmacklem@uoguelph.ca) Received: from skerryvore.cs.uoguelph.ca (skerryvore.cs.uoguelph.ca [131.104.94.204]) by mx1.freebsd.org (Postfix) with ESMTP id 489E88FC1F for ; Mon, 27 Apr 2009 14:51:45 +0000 (UTC) (envelope-from rmacklem@uoguelph.ca) Received: from muncher.cs.uoguelph.ca (muncher.cs.uoguelph.ca [131.104.91.102]) by skerryvore.cs.uoguelph.ca (8.13.1/8.13.1) with ESMTP id n3REpiSp008645; Mon, 27 Apr 2009 10:51:44 -0400 Received: from localhost (rmacklem@localhost) by muncher.cs.uoguelph.ca (8.11.7p3+Sun/8.11.6) with ESMTP id n3REwhj18742; Mon, 27 Apr 2009 10:58:44 -0400 (EDT) X-Authentication-Warning: muncher.cs.uoguelph.ca: rmacklem owned process doing -bs Date: Mon, 27 Apr 2009 10:58:43 -0400 (EDT) From: Rick Macklem X-X-Sender: rmacklem@muncher.cs.uoguelph.ca To: "Rick C. Petty" In-Reply-To: <20090427135200.GA59201@keira.kiwi-computer.com> Message-ID: References: <20090426210343.GA51829@keira.kiwi-computer.com> <20090427135200.GA59201@keira.kiwi-computer.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Scanned-By: MIMEDefang 2.63 on 131.104.94.221 Cc: freebsd-fs@freebsd.org Subject: Re: Why do some ufs i-node fields have 2 copies? 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: Mon, 27 Apr 2009 14:51:46 -0000 On Mon, 27 Apr 2009, Rick C. Petty wrote: [good stuff snipped] >> If my interpretation of your answer is correct, I'd say that a "shadow >> copy" doesn't really add anything to the code? What do others think? > > It adds plenty-- you don't have to dereference more than the inode pointer. > If you don't use the shadows, you have to dereference the superblock (i_fs) > to get the UFS version as well as dereference the dinode itself. It > doesn't make sense to change all the macros to not use the shadows. > Oops, poorly expressed. What I meant to say was "doesn't really add anything to the line of code I listed in the original message": DIP_SET(ip, i_modrev, DIP(ip, i_modrev) + 1); since that is the only time i_modrev is manipulated. (I didn't mean "doesn't add anything to the code, in general".) If I were to add a "shadow copy" of i_modrev, the line would become: ip->i_modrev++; DIP_SET(ip, i_modrev, ip->i_modrev); and then ip->i_modrev = ip->i_din1->di_modrev; and ip->i_modrev = ip->i_din2->di_modrev; would have to be added to ffs_subr.c and an extra field added to the i-node structure for the "shadow copy". I don't think this would be an improvement compared to the one line. Does it make sense this time? Thanks, rick From owner-freebsd-fs@FreeBSD.ORG Mon Apr 27 15:03:37 2009 Return-Path: Delivered-To: freebsd-fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2843F10656F8 for ; Mon, 27 Apr 2009 15:03:37 +0000 (UTC) (envelope-from rick@kiwi-computer.com) Received: from kiwi-computer.com (keira.kiwi-computer.com [63.224.10.3]) by mx1.freebsd.org (Postfix) with SMTP id AD0B08FC14 for ; Mon, 27 Apr 2009 15:03:34 +0000 (UTC) (envelope-from rick@kiwi-computer.com) Received: (qmail 59817 invoked by uid 2001); 27 Apr 2009 15:03:34 -0000 Date: Mon, 27 Apr 2009 10:03:34 -0500 From: "Rick C. Petty" To: Rick Macklem Message-ID: <20090427150334.GA59796@keira.kiwi-computer.com> References: <20090426210343.GA51829@keira.kiwi-computer.com> <20090427135200.GA59201@keira.kiwi-computer.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i Cc: freebsd-fs@freebsd.org Subject: Re: Why do some ufs i-node fields have 2 copies? X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: rick-freebsd2008@kiwi-computer.com List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Apr 2009 15:03:37 -0000 On Mon, Apr 27, 2009 at 10:58:43AM -0400, Rick Macklem wrote: > > > Oops, poorly expressed. What I meant to say was "doesn't really add > anything to > the line of code I listed in the original message": > > DIP_SET(ip, i_modrev, DIP(ip, i_modrev) + 1); > > since that is the only time i_modrev is manipulated. (I didn't mean "doesn't > add anything to the code, in general".) > Does it make sense this time? Yes, that makes total sense. -- Rick C. Petty From owner-freebsd-fs@FreeBSD.ORG Sat May 2 08:30:03 2009 Return-Path: Delivered-To: freebsd-fs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3110E1065674 for ; Sat, 2 May 2009 08:30:03 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 1BA578FC0A for ; Sat, 2 May 2009 08:30:03 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id n428U2QM056811 for ; Sat, 2 May 2009 08:30:02 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.3/8.14.3/Submit) id n428U2vW056808; Sat, 2 May 2009 08:30:02 GMT (envelope-from gnats) Date: Sat, 2 May 2009 08:30:02 GMT Message-Id: <200905020830.n428U2vW056808@freefall.freebsd.org> To: freebsd-fs@FreeBSD.org From: Lagrange Marc Cc: Subject: Re: kern/132960: [ufs] [panic] panic:ffs_blkfree: freeing free frag X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Lagrange Marc List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 May 2009 08:30:03 -0000 The following reply was made to PR kern/132960; it has been noted by GNATS. From: Lagrange Marc To: bug-followup@FreeBSD.org, kevinxlinuz@163.com Cc: Subject: Re: kern/132960: [ufs] [panic] panic:ffs_blkfree: freeing free frag Date: Sat, 2 May 2009 09:58:29 +0200 Hi, I think i've also the bug with panic: ffs_blkfree but my panic is : fsync: giving up on dirty 0xc3ff3114: tag devfs, type VCHR usecount 1, writecount 0, refcount 771 mountedhere 0xc3fac300 flags () v_object 0xc1045600 ref 0 pages 3836 lock type devfs: EXCL (count 1) by thread 0xc41a6690 (pid 1831) dev ad4s1f fsync: giving up on dirty 0xc3ff3114: tag devfs, type VCHR usecount 1, writecount 0, refcount 771 mountedhere 0xc3fac300 flags () v_object 0xc1045600 ref 0 pages 3836 lock type devfs: EXCL (count 1) by thread 0xc41a6690 (pid 1831) dev ad4s1f dev = ad4s1f, block = 1, fs = /usr panic: ffs_blkfree: freeing free block I've got this, two times i think when rebuilding the kernel, this is a FreeBSD 7.2-RELEASE installed last day in 7.2-RC2 and recompilled in 7.2-RELEASE. I can't reproduce this bug for the moment... Is it related ? Any informations about this bug ? Thx. From owner-freebsd-fs@FreeBSD.ORG Sat May 2 10:26:25 2009 Return-Path: Delivered-To: freebsd-fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9D6621065672 for ; Sat, 2 May 2009 10:26:25 +0000 (UTC) (envelope-from Juergen.Dankoweit@T-Online.de) Received: from mailout03.t-online.de (mailout03.t-online.de [194.25.134.81]) by mx1.freebsd.org (Postfix) with ESMTP id 59E4F8FC17 for ; Sat, 2 May 2009 10:26:25 +0000 (UTC) (envelope-from Juergen.Dankoweit@T-Online.de) Received: from fwd11.aul.t-online.de by mailout03.sul.t-online.de with smtp id 1M0CAB-0004M4-00; Sat, 02 May 2009 12:09:43 +0200 Received: from routerdeluxe.juergendankoweit.net (b7GL3OZHrh1+TmGoo7QX3X97w4sIx4GT1y4g3xAozTukXCzm5EJE+Yc9kInKa+oQZF@[87.174.242.171]) by fwd11.aul.t-online.de with esmtp id 1M0C9t-26I9ke0; Sat, 2 May 2009 12:09:25 +0200 Received: from localhost (localhost [127.0.0.1]) by routerdeluxe.juergendankoweit.net (Postfix) with ESMTP id BCE6522A69 for ; Sat, 2 May 2009 12:09:24 +0200 (CEST) Received: from t43.juergendankoweit.net (t43.juergendankoweit.net [192.168.1.194]) by routerdeluxe.juergendankoweit.net (Postfix) with ESMTPA id 4C2A6229D9 for ; Sat, 2 May 2009 12:09:21 +0200 (CEST) Message-ID: <49FC1BD0.4030306@T-Online.de> Date: Sat, 02 May 2009 12:09:20 +0200 From: Juergen Dankoweit User-Agent: Thunderbird 2.0.0.18 (X11/20081220) MIME-Version: 1.0 To: freebsd-fs@freebsd.org Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: ClamAV using ClamSMTP X-ID: b7GL3OZHrh1+TmGoo7QX3X97w4sIx4GT1y4g3xAozTukXCzm5EJE+Yc9kInKa+oQZF X-TOI-MSGID: 9214a30b-9db9-4db3-816e-fd199bd5684e Subject: UFS2 and SSDs X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Juergen.Dankoweit@T-Online.de List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 May 2009 10:26:25 -0000 Hello to the list, my question is, how does UFS2 behave on solid state disks? What about performance, stability and data security? Many thanks for the answers. Best regards J.D.