看板 DFBSD_kernel 關於我們 聯絡資訊
Please ignore the second question. I thought KKASSERT was doing things the other way around :) Thanks, Rongsheng On Tue, Mar 08, 2005 at 12:47:05PM -0500, Rongsheng Fang wrote: > Date: Tue, 8 Mar 2005 12:47:05 -0500 > From: Rongsheng Fang <rfang@coke.umuc.edu> > To: kernel@crater.dragonflybsd.org > Subject: vfs_journal.c code questions > Mail-Followup-To: Rongsheng Fang <rfang@coke.umuc.edu>, > kernel@crater.dragonflybsd.org > Message-Id: <20050308174705.GB29199@coke.umuc.edu> > > I was reading through the vfs_journal.c code and was confused by some > of the code: > > /usr/src/sys/kern/vfs_journal.c > > In function journal_install_vfs_journal() > > ... > jrecord_init(jo, &jrec, JREC_STREAMID_DISCONT); > jrecord_write(&jrec, JTYPE_ASSOCIATE, 0); > ... > > > 1) the `streamid' parameter for jrecord_init() is set to > JREC_STREAMID_DISCONT which is defined as 0x0002. > > While in function jrecord_init(): > > ... > if (streamid < 0) { > streamid = sid++; /* XXX need to track stream ids! */ > if (sid == JREC_STREAMID_JMAX) > sid = JREC_STREAMID_JMIN; > } > jrec->streamid = streamid; > ... > > So now jrec->streamid is JREC_STREAMID_DISCONT (0x0002). > > Shouldn't streamid be some number between JREC_STREAMID_JMIN and > JREC_STREAMID_JMAX? > > #define JREC_STREAMID_JMIN 0x0100 /* lowest allowed general id */ > #define JREC_STREAMID_JMAX 0x2000 /* (one past the highest allowed id) */ > > 2) then jrecord_write() comes right after jrecord_init() (also in > function journal_install_vfs_journal()): > > jrecord_write(&jrec, JTYPE_ASSOCIATE, 0); > > In function jrecord_write(): > > /* > * Try to catch some obvious errors. Nesting records must specify a > * size of 0, and there should be no left-overs from previous operations > * (such as incomplete data writeouts). > */ > KKASSERT(bytes == 0 || (rectype & JMASK_NESTED) == 0); > KKASSERT(jrec->residual == 0); > > Then the kernel is going to panic? Actually it's not in practice, so > I am a bit confused :( > > Thanks, > > Rongsheng > > !DSPAM:422de5af1814491114!