From owner-freebsd-hackers Thu Dec 13 16:43:33 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from apollo.backplane.com (apollo.backplane.com [216.240.41.2]) by hub.freebsd.org (Postfix) with ESMTP id 3DECC37B405; Thu, 13 Dec 2001 16:43:29 -0800 (PST) Received: (from dillon@localhost) by apollo.backplane.com (8.11.6/8.9.1) id fBE0gBa61696; Thu, 13 Dec 2001 16:42:11 -0800 (PST) (envelope-from dillon) Date: Thu, 13 Dec 2001 16:42:11 -0800 (PST) From: Matthew Dillon Message-Id: <200112140042.fBE0gBa61696@apollo.backplane.com> To: Terry Lambert Cc: David Greenman , Jordan Hubbard , Peter Wemm , Mike Smith , hackers@FreeBSD.ORG, msmith@mass.dis.org Subject: Re: NFS Patch #4 -- survived overnight test. (was Re: Found NFS data corruption bug... (was Re:...)) References: <58885.1008217148@winston.freebsd.org> <200112130608.fBD689K49906@apollo.backplane.com> <20011212224927.A73226@nexus.root.com> <200112131835.fBDIZuL70031@apollo.backplane.com> <3C18FAC9.E743DAA5@mindspring.com> Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG :Matthew Dillon wrote: :[ ... ] :> I would appreciate other VM gurus taking a look at the :> vm_page_set_validclean() changes. :[ ... ] : :Not to appoint myself a guru or anything... : :> +#if 1 :> + if ((base & (DEV_BSIZE - 1)) || (size & (DEV_BSIZE - 1))) { :> + int adj; :> + :> + adj = DEV_BSIZE - (base & (DEV_BSIZE - 1)); :> + base += adj; :> + if (size < adj) :> + size = 0; :> + else :> + size = (size - adj) & ~(DEV_BSIZE - 1); :> + pagebits = vm_page_bits(base, size); :> + } :> +#endif : :This seems wrong. : :Specifically, it seems to only get the first block, in the case that :(integer math: / is "div"): : : ((size - adj)/DEV_BSIZE) > 1 : :How about: : : else { : /* : * Drop partial trailing blocks from the size : * calculation to maintain correct dirty bits; : * note that 'size' might still span more than : * one block, though. : */ : int n_size; /* probably not int? */ : : n_size = (size - adj) / DEV_BSIZE; : size = (size - adj) & ~(DEV_BSIZE - 1); : size += n_size * DEV_BSIZE; : : } : :-- Terry Hmm. Well, my code is definitely broken. My 'adj' calculation is all wrong. However, my size calculation appears to be correct. (size - adj) is the size of the block after the base has been adjusted to the next full chunk. The number of chunks we then generate bits for must be fully enclosed by size and (new_size & ~(DEV_BSIZE - 1)) gives that to us. e.g. if new_size is less then DEV_BSIZE we get 0, correctly indicating that we cannot clear any dirty bits at all. -Matt Matthew Dillon To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message