Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 13 Dec 2001 16:42:11 -0800 (PST)
From:      Matthew Dillon <dillon@apollo.backplane.com>
To:        Terry Lambert <tlambert2@mindspring.com>
Cc:        David Greenman <dg@root.com>, Jordan Hubbard <jkh@winston.freebsd.org>, Peter Wemm <peter@wemm.org>, Mike Smith <msmith@FreeBSD.ORG>, hackers@FreeBSD.ORG, msmith@mass.dis.org
Subject:   Re: NFS Patch #4 -- survived overnight test. (was Re: Found NFS data  corruption bug... (was Re:...))
Message-ID:  <200112140042.fBE0gBa61696@apollo.backplane.com>
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>

next in thread | previous in thread | raw e-mail | index | archive | help

: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 
					<dillon@backplane.com>

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200112140042.fBE0gBa61696>