Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 11 Mar 1999 10:20:48 -0800 (PST)
From:      Matthew Dillon <dillon@apollo.backplane.com>
To:        "Mark J. Taylor" <mtaylor@cybernet.com>
Cc:        jkh@FreeBSD.ORG, msmith@FreeBSD.ORG, freebsd-hackers@FreeBSD.ORG
Subject:   Re: ccd driver problems with > 2GB segments, +fix
Message-ID:  <199903111820.KAA66914@apollo.backplane.com>
References:   <XFMail.990311110304.mtaylor@cybernet.com>

next in thread | previous in thread | raw e-mail | index | archive | help
:The fixes actually came at two separate times: one to fix
:the panic, and another to fix the filesystem.
:...
:The second fix (the off_t) is really the only fix needed.  The
:first patch (the u_long) is not necessary: it hid the real
:problem under most cases (32 bit << 9 being put into a 32 bit
:value ends up being negative much of the time!), until the
:math worked out "badly".
:
:Here's the final and complete patch (for -current):
:(this is exactly what NetBSD does, BTW)

    Ah!  Ok, now I understand.

    This seems totally reasonable.  Jordan or David, can you commit this
    into -4.x plus backport it to 3.x?  I don't think it needs any additional
    review.

					-Matt
					Matthew Dillon 
					<dillon@backplane.com>

:*** ccd.c.orig  Wed Mar 10 11:22:41 1999
:--- ccd.c       Thu Mar 11 10:53:13 1999
:***************
:*** 841,846 ****
:--- 841,847 ----
:        register struct ccdcinfo *ci, *ci2 = NULL;      /* XXX */
:        register struct ccdbuf *cbp;
:        register daddr_t cbn, cboff;
:+       register off_t cbc;
:  
:  #ifdef DEBUG
:        if (ccddebug & CCDB_IO)
:***************
:*** 919,929 ****
:        LIST_INIT(&cbp->cb_buf.b_dep);
:        cbp->cb_buf.b_resid = 0;
:        if (cs->sc_ileave == 0)
:!               cbp->cb_buf.b_bcount = dbtob(ci->ci_size - cbn);
:        else
:!               cbp->cb_buf.b_bcount = dbtob(cs->sc_ileave - cboff);
:!       if (cbp->cb_buf.b_bcount > bcount)
:!               cbp->cb_buf.b_bcount = bcount;
:  
:        cbp->cb_buf.b_bufsize = cbp->cb_buf.b_bcount;
:  
:--- 920,929 ----
:        LIST_INIT(&cbp->cb_buf.b_dep);
:        cbp->cb_buf.b_resid = 0;
:        if (cs->sc_ileave == 0)
:!               cbc = dbtob((off_t)(ci->ci_size - cbn));
:        else
:!               cbc = dbtob((off_t)(cs->sc_ileave - cboff));
:!       cbp->cb_buf.b_bcount = (cbc < bcount) ? cbc : bcount;
:  
:        cbp->cb_buf.b_bufsize = cbp->cb_buf.b_bcount;
:
:
:
:
:
:On 11-Mar-99 Matthew Dillon wrote:
:>     Interesting.  What if each disk is 8GB and we set the stripe
:>     size to 8GB?  Won't that break the u_long ( i.e. was broken
:>     before, and is still broken now ).  Perhaps these variables
:>     should be 64 bit quantities throughout except for the
:>     bp->b_count?
:> 
:>                                       -Matt
:>                                       Matthew Dillon 
:>                                       <dillon@backplane.com>
:> 
:>:Fix:
:>:The ccd driver has a variable "bcount" that is a long: it needs
:>:to be a u_long.  And, a 64 bit int is shifted into a 32 bit int
:>:in ccdbuffer(): the 32 bit int must changed to be a 64 bit int.
:>:
:>:This second change has already been made in NetBSD (somebody else
:>:figured it out), where the ccd driver originated from.  It was
:>:rather tricky to find: the math involving block numbers and ccd
:>:...
:
:--------------------------------------------------------------------
:Mark J. Taylor                                   Networking Research
:Cybernet Systems                                mtaylor@cybernet.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?199903111820.KAA66914>