* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $DragonFly: src/sys/kern/vfs_jops.c,v 1.25 2006/05/06 06:38:38 dillon Exp $
+ * $DragonFly: src/sys/kern/vfs_jops.c,v 1.26 2006/05/07 00:24:56 dillon Exp $
*/
/*
* Each mount point may have zero or more independantly configured journals
static int
journal_attach(struct mount *mp)
{
+ KKASSERT(mp->mnt_jbitmap == NULL);
vfs_add_vnodeops(mp, &mp->mnt_vn_journal_ops,
journal_vnodeop_entries, 0);
+ mp->mnt_jbitmap = malloc(JREC_STREAMID_JMAX/8, M_JOURNAL, M_WAITOK|M_ZERO);
+ mp->mnt_streamid = JREC_STREAMID_JMIN;
return(0);
}
static void
journal_detach(struct mount *mp)
{
+ KKASSERT(mp->mnt_jbitmap != NULL);
if (mp->mnt_vn_journal_ops)
vfs_rm_vnodeops(&mp->mnt_vn_journal_ops);
+ free(mp->mnt_jbitmap, M_JOURNAL);
+ mp->mnt_jbitmap = NULL;
}
/*
if (jo->fifo.membase)
free(jo->fifo.membase, M_JFIFO);
free(jo, M_JOURNAL);
+
return(0);
}
{
struct journal *jo;
struct jrecord *jrec;
- int wantrev = 0;
- int count = 0;
+ int wantrev;
+ int count;
+ int16_t streamid;
+
+ TAILQ_INIT(&jreclist->list);
+
+ /*
+ * Select the stream ID to use for the transaction. We must select
+ * a stream ID that is not currently in use by some other parallel
+ * transaction.
+ *
+ * Don't bother calculating the next streamid when reassigning
+ * mnt_streamid, since parallel transactions are fairly rare. This
+ * also allows someone observing the raw records to clearly see
+ * when parallel transactions occur.
+ */
+ streamid = mp->mnt_streamid;
+ count = 0;
+ while (mp->mnt_jbitmap[streamid >> 3] & (1 << (streamid & 7))) {
+ if (++streamid == JREC_STREAMID_JMAX)
+ streamid = JREC_STREAMID_JMIN;
+ if (++count == JREC_STREAMID_JMAX - JREC_STREAMID_JMIN) {
+ printf("jreclist_init: all streamid's in use! sleeping\n");
+ tsleep(jreclist, 0, "jsidfl", hz * 10);
+ count = 0;
+ }
+ }
+ mp->mnt_jbitmap[streamid >> 3] |= 1 << (streamid & 7);
+ mp->mnt_streamid = streamid;
+ jreclist->streamid = streamid;
- TAILQ_INIT(jreclist);
+ /*
+ * Now initialize a stream on each journal.
+ */
+ count = 0;
+ wantrev = 0;
TAILQ_FOREACH(jo, &mp->mnt_jlist, jentry) {
if (count == 0)
jrec = jreccache;
else
jrec = malloc(sizeof(*jrec), M_JOURNAL, M_WAITOK);
- jrecord_init(jo, jrec, -1);
+ jrecord_init(jo, jrec, streamid);
jrec->user_save = jrecord_push(jrec, rectype);
- TAILQ_INSERT_TAIL(jreclist, jrec, user_entry);
+ TAILQ_INSERT_TAIL(&jreclist->list, jrec, user_entry);
if (jo->flags & MC_JOURNAL_WANT_REVERSABLE)
wantrev = 1;
++count;
*/
static
void
-jreclist_done(struct jrecord_list *jreclist, int error)
+jreclist_done(struct mount *mp, struct jrecord_list *jreclist, int error)
{
struct jrecord *jrec;
int count;
- TAILQ_FOREACH(jrec, jreclist, user_entry) {
+ /*
+ * Cleanup the jrecord state on each journal.
+ */
+ TAILQ_FOREACH(jrec, &jreclist->list, user_entry) {
jrecord_pop(jrec, jrec->user_save);
jrecord_done(jrec, error);
}
+
+ /*
+ * Free allocated jrec's (the first is always supplied)
+ */
count = 0;
- while ((jrec = TAILQ_FIRST(jreclist)) != NULL) {
- TAILQ_REMOVE(jreclist, jrec, user_entry);
+ while ((jrec = TAILQ_FIRST(&jreclist->list)) != NULL) {
+ TAILQ_REMOVE(&jreclist->list, jrec, user_entry);
if (count)
free(jrec, M_JOURNAL);
++count;
}
+
+ /*
+ * Clear the streamid so it can be reused.
+ */
+ mp->mnt_jbitmap[jreclist->streamid >> 3] &= ~(1 << (jreclist->streamid & 7));
}
/*
if (jrflags & JRUNDO_GETVP)
error = vget(vp, LK_SHARED);
if (error == 0) {
- TAILQ_FOREACH(jrec, jreclist, user_entry) {
+ TAILQ_FOREACH(jrec, &jreclist->list, user_entry) {
if (jrec->jo->flags & MC_JOURNAL_WANT_REVERSABLE) {
jrecord_undo_file(jrec, vp, jrflags, off, bytes);
}
* in the logical streams managed by the journal_*() routines.
*/
-static int16_t sid = JREC_STREAMID_JMIN;
-
/*
* Initialize the passed jrecord structure and start a new stream transaction
* by reserving an initial build space in the journal's memory FIFO.
{
bzero(jrec, sizeof(*jrec));
jrec->jo = jo;
- if (streamid < 0) {
- streamid = sid++; /* XXX need to track stream ids! */
- if (sid == JREC_STREAMID_JMAX)
- sid = JREC_STREAMID_JMIN;
- }
jrec->streamid = streamid;
jrec->stream_residual = JREC_DEFAULTSIZE;
jrec->stream_reserved = jrec->stream_residual;
}
error = vop_journal_operate_ap(&ap->a_head);
if (error == 0) {
- TAILQ_FOREACH(jrec, &jreclist, user_entry) {
+ TAILQ_FOREACH(jrec, &jreclist.list, user_entry) {
jrecord_write_cred(jrec, curthread, ap->a_cred);
jrecord_write_vnode_ref(jrec, ap->a_vp);
save = jrecord_push(jrec, JTYPE_REDO);
jrecord_pop(jrec, save);
}
}
- jreclist_done(&jreclist, error);
+ jreclist_done(mp, &jreclist, error);
return (error);
}
* Output the write data to the journal.
*/
if (error == 0) {
- TAILQ_FOREACH(jrec, &jreclist, user_entry) {
+ TAILQ_FOREACH(jrec, &jreclist.list, user_entry) {
jrecord_write_cred(jrec, NULL, ap->a_cred);
jrecord_write_vnode_ref(jrec, ap->a_vp);
save = jrecord_push(jrec, JTYPE_REDO);
jrecord_pop(jrec, save);
}
}
- jreclist_done(&jreclist, error);
+ jreclist_done(mp, &jreclist, error);
if (uio_copy.uio_iov != &uio_one_iovec)
free(uio_copy.uio_iov, M_JOURNAL);
}
error = vop_journal_operate_ap(&ap->a_head);
if (error == 0 && ap->a_count > 0) {
- TAILQ_FOREACH(jrec, &jreclist, user_entry) {
+ TAILQ_FOREACH(jrec, &jreclist.list, user_entry) {
jrecord_write_vnode_ref(jrec, ap->a_vp);
save = jrecord_push(jrec, JTYPE_REDO);
jrecord_write_pagelist(jrec, JLEAF_FILEDATA, ap->a_m, ap->a_rtvals,
jrecord_pop(jrec, save);
}
}
- jreclist_done(&jreclist, error);
+ jreclist_done(mp, &jreclist, error);
return (error);
}
jreclist_init(mp, &jreclist, &jreccache, JTYPE_SETACL);
error = vop_journal_operate_ap(&ap->a_head);
if (error == 0) {
- TAILQ_FOREACH(jrec, &jreclist, user_entry) {
+ TAILQ_FOREACH(jrec, &jreclist.list, user_entry) {
#if 0
if ((jo->flags & MC_JOURNAL_WANT_REVERSABLE))
jrecord_undo_file(jrec, ap->a_vp, JRUNDO_XXX, 0, 0);
#endif
}
}
- jreclist_done(&jreclist, error);
+ jreclist_done(mp, &jreclist, error);
return (error);
}
jreclist_init(mp, &jreclist, &jreccache, JTYPE_SETEXTATTR);
error = vop_journal_operate_ap(&ap->a_head);
if (error == 0) {
- TAILQ_FOREACH(jrec, &jreclist, user_entry) {
+ TAILQ_FOREACH(jrec, &jreclist.list, user_entry) {
#if 0
if ((jo->flags & MC_JOURNAL_WANT_REVERSABLE))
jrecord_undo_file(jrec, ap->a_vp, JRUNDO_XXX, 0, 0);
jrecord_pop(jrec, save);
}
}
- jreclist_done(&jreclist, error);
+ jreclist_done(mp, &jreclist, error);
return (error);
}
jreclist_init(mp, &jreclist, &jreccache, JTYPE_CREATE);
error = vop_journal_operate_ap(&ap->a_head);
if (error == 0) {
- TAILQ_FOREACH(jrec, &jreclist, user_entry) {
+ TAILQ_FOREACH(jrec, &jreclist.list, user_entry) {
jrecord_write_cred(jrec, NULL, ap->a_cred);
jrecord_write_path(jrec, JLEAF_PATH1, ap->a_ncp);
if (*ap->a_vpp)
jrecord_pop(jrec, save);
}
}
- jreclist_done(&jreclist, error);
+ jreclist_done(mp, &jreclist, error);
return (error);
}
jreclist_init(mp, &jreclist, &jreccache, JTYPE_MKNOD);
error = vop_journal_operate_ap(&ap->a_head);
if (error == 0) {
- TAILQ_FOREACH(jrec, &jreclist, user_entry) {
+ TAILQ_FOREACH(jrec, &jreclist.list, user_entry) {
jrecord_write_cred(jrec, NULL, ap->a_cred);
jrecord_write_path(jrec, JLEAF_PATH1, ap->a_ncp);
save = jrecord_push(jrec, JTYPE_REDO);
jrecord_write_vnode_ref(jrec, *ap->a_vpp);
}
}
- jreclist_done(&jreclist, error);
+ jreclist_done(mp, &jreclist, error);
return (error);
}
jreclist_init(mp, &jreclist, &jreccache, JTYPE_LINK);
error = vop_journal_operate_ap(&ap->a_head);
if (error == 0) {
- TAILQ_FOREACH(jrec, &jreclist, user_entry) {
+ TAILQ_FOREACH(jrec, &jreclist.list, user_entry) {
jrecord_write_cred(jrec, NULL, ap->a_cred);
jrecord_write_path(jrec, JLEAF_PATH1, ap->a_ncp);
/* XXX PATH to VP and inode number */
jrecord_pop(jrec, save);
}
}
- jreclist_done(&jreclist, error);
+ jreclist_done(mp, &jreclist, error);
return (error);
}
jreclist_init(mp, &jreclist, &jreccache, JTYPE_SYMLINK);
error = vop_journal_operate_ap(&ap->a_head);
if (error == 0) {
- TAILQ_FOREACH(jrec, &jreclist, user_entry) {
+ TAILQ_FOREACH(jrec, &jreclist.list, user_entry) {
jrecord_write_cred(jrec, NULL, ap->a_cred);
jrecord_write_path(jrec, JLEAF_PATH1, ap->a_ncp);
save = jrecord_push(jrec, JTYPE_REDO);
jrecord_write_vnode_ref(jrec, *ap->a_vpp);
}
}
- jreclist_done(&jreclist, error);
+ jreclist_done(mp, &jreclist, error);
return (error);
}
jreclist_init(mp, &jreclist, &jreccache, JTYPE_WHITEOUT);
error = vop_journal_operate_ap(&ap->a_head);
if (error == 0) {
- TAILQ_FOREACH(jrec, &jreclist, user_entry) {
+ TAILQ_FOREACH(jrec, &jreclist.list, user_entry) {
jrecord_write_cred(jrec, NULL, ap->a_cred);
jrecord_write_path(jrec, JLEAF_PATH1, ap->a_ncp);
}
}
- jreclist_done(&jreclist, error);
+ jreclist_done(mp, &jreclist, error);
return (error);
}
}
error = vop_journal_operate_ap(&ap->a_head);
if (error == 0) {
- TAILQ_FOREACH(jrec, &jreclist, user_entry) {
+ TAILQ_FOREACH(jrec, &jreclist.list, user_entry) {
jrecord_write_cred(jrec, NULL, ap->a_cred);
jrecord_write_path(jrec, JLEAF_PATH1, ap->a_ncp);
}
}
- jreclist_done(&jreclist, error);
+ jreclist_done(mp, &jreclist, error);
return (error);
}
jreclist_init(mp, &jreclist, &jreccache, JTYPE_MKDIR);
error = vop_journal_operate_ap(&ap->a_head);
if (error == 0) {
- TAILQ_FOREACH(jrec, &jreclist, user_entry) {
+ TAILQ_FOREACH(jrec, &jreclist.list, user_entry) {
#if 0
if (jo->flags & MC_JOURNAL_WANT_AUDIT) {
jrecord_write_audit(jrec);
jrecord_write_vnode_ref(jrec, *ap->a_vpp);
}
}
- jreclist_done(&jreclist, error);
+ jreclist_done(mp, &jreclist, error);
return (error);
}
}
error = vop_journal_operate_ap(&ap->a_head);
if (error == 0) {
- TAILQ_FOREACH(jrec, &jreclist, user_entry) {
+ TAILQ_FOREACH(jrec, &jreclist.list, user_entry) {
jrecord_write_cred(jrec, NULL, ap->a_cred);
jrecord_write_path(jrec, JLEAF_PATH1, ap->a_ncp);
}
}
- jreclist_done(&jreclist, error);
+ jreclist_done(mp, &jreclist, error);
return (error);
}
}
error = vop_journal_operate_ap(&ap->a_head);
if (error == 0) {
- TAILQ_FOREACH(jrec, &jreclist, user_entry) {
+ TAILQ_FOREACH(jrec, &jreclist.list, user_entry) {
jrecord_write_cred(jrec, NULL, ap->a_cred);
jrecord_write_path(jrec, JLEAF_PATH1, ap->a_fncp);
jrecord_write_path(jrec, JLEAF_PATH2, ap->a_tncp);
}
}
- jreclist_done(&jreclist, error);
+ jreclist_done(mp, &jreclist, error);
return (error);
}
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $DragonFly: src/sys/kern/vfs_journal.c,v 1.25 2006/05/06 06:38:38 dillon Exp $
+ * $DragonFly: src/sys/kern/vfs_journal.c,v 1.26 2006/05/07 00:24:56 dillon Exp $
*/
/*
* Each mount point may have zero or more independantly configured journals
static int
journal_attach(struct mount *mp)
{
+ KKASSERT(mp->mnt_jbitmap == NULL);
vfs_add_vnodeops(mp, &mp->mnt_vn_journal_ops,
journal_vnodeop_entries, 0);
+ mp->mnt_jbitmap = malloc(JREC_STREAMID_JMAX/8, M_JOURNAL, M_WAITOK|M_ZERO);
+ mp->mnt_streamid = JREC_STREAMID_JMIN;
return(0);
}
static void
journal_detach(struct mount *mp)
{
+ KKASSERT(mp->mnt_jbitmap != NULL);
if (mp->mnt_vn_journal_ops)
vfs_rm_vnodeops(&mp->mnt_vn_journal_ops);
+ free(mp->mnt_jbitmap, M_JOURNAL);
+ mp->mnt_jbitmap = NULL;
}
/*
if (jo->fifo.membase)
free(jo->fifo.membase, M_JFIFO);
free(jo, M_JOURNAL);
+
return(0);
}
{
struct journal *jo;
struct jrecord *jrec;
- int wantrev = 0;
- int count = 0;
+ int wantrev;
+ int count;
+ int16_t streamid;
+
+ TAILQ_INIT(&jreclist->list);
+
+ /*
+ * Select the stream ID to use for the transaction. We must select
+ * a stream ID that is not currently in use by some other parallel
+ * transaction.
+ *
+ * Don't bother calculating the next streamid when reassigning
+ * mnt_streamid, since parallel transactions are fairly rare. This
+ * also allows someone observing the raw records to clearly see
+ * when parallel transactions occur.
+ */
+ streamid = mp->mnt_streamid;
+ count = 0;
+ while (mp->mnt_jbitmap[streamid >> 3] & (1 << (streamid & 7))) {
+ if (++streamid == JREC_STREAMID_JMAX)
+ streamid = JREC_STREAMID_JMIN;
+ if (++count == JREC_STREAMID_JMAX - JREC_STREAMID_JMIN) {
+ printf("jreclist_init: all streamid's in use! sleeping\n");
+ tsleep(jreclist, 0, "jsidfl", hz * 10);
+ count = 0;
+ }
+ }
+ mp->mnt_jbitmap[streamid >> 3] |= 1 << (streamid & 7);
+ mp->mnt_streamid = streamid;
+ jreclist->streamid = streamid;
- TAILQ_INIT(jreclist);
+ /*
+ * Now initialize a stream on each journal.
+ */
+ count = 0;
+ wantrev = 0;
TAILQ_FOREACH(jo, &mp->mnt_jlist, jentry) {
if (count == 0)
jrec = jreccache;
else
jrec = malloc(sizeof(*jrec), M_JOURNAL, M_WAITOK);
- jrecord_init(jo, jrec, -1);
+ jrecord_init(jo, jrec, streamid);
jrec->user_save = jrecord_push(jrec, rectype);
- TAILQ_INSERT_TAIL(jreclist, jrec, user_entry);
+ TAILQ_INSERT_TAIL(&jreclist->list, jrec, user_entry);
if (jo->flags & MC_JOURNAL_WANT_REVERSABLE)
wantrev = 1;
++count;
*/
static
void
-jreclist_done(struct jrecord_list *jreclist, int error)
+jreclist_done(struct mount *mp, struct jrecord_list *jreclist, int error)
{
struct jrecord *jrec;
int count;
- TAILQ_FOREACH(jrec, jreclist, user_entry) {
+ /*
+ * Cleanup the jrecord state on each journal.
+ */
+ TAILQ_FOREACH(jrec, &jreclist->list, user_entry) {
jrecord_pop(jrec, jrec->user_save);
jrecord_done(jrec, error);
}
+
+ /*
+ * Free allocated jrec's (the first is always supplied)
+ */
count = 0;
- while ((jrec = TAILQ_FIRST(jreclist)) != NULL) {
- TAILQ_REMOVE(jreclist, jrec, user_entry);
+ while ((jrec = TAILQ_FIRST(&jreclist->list)) != NULL) {
+ TAILQ_REMOVE(&jreclist->list, jrec, user_entry);
if (count)
free(jrec, M_JOURNAL);
++count;
}
+
+ /*
+ * Clear the streamid so it can be reused.
+ */
+ mp->mnt_jbitmap[jreclist->streamid >> 3] &= ~(1 << (jreclist->streamid & 7));
}
/*
if (jrflags & JRUNDO_GETVP)
error = vget(vp, LK_SHARED);
if (error == 0) {
- TAILQ_FOREACH(jrec, jreclist, user_entry) {
+ TAILQ_FOREACH(jrec, &jreclist->list, user_entry) {
if (jrec->jo->flags & MC_JOURNAL_WANT_REVERSABLE) {
jrecord_undo_file(jrec, vp, jrflags, off, bytes);
}
* in the logical streams managed by the journal_*() routines.
*/
-static int16_t sid = JREC_STREAMID_JMIN;
-
/*
* Initialize the passed jrecord structure and start a new stream transaction
* by reserving an initial build space in the journal's memory FIFO.
{
bzero(jrec, sizeof(*jrec));
jrec->jo = jo;
- if (streamid < 0) {
- streamid = sid++; /* XXX need to track stream ids! */
- if (sid == JREC_STREAMID_JMAX)
- sid = JREC_STREAMID_JMIN;
- }
jrec->streamid = streamid;
jrec->stream_residual = JREC_DEFAULTSIZE;
jrec->stream_reserved = jrec->stream_residual;
}
error = vop_journal_operate_ap(&ap->a_head);
if (error == 0) {
- TAILQ_FOREACH(jrec, &jreclist, user_entry) {
+ TAILQ_FOREACH(jrec, &jreclist.list, user_entry) {
jrecord_write_cred(jrec, curthread, ap->a_cred);
jrecord_write_vnode_ref(jrec, ap->a_vp);
save = jrecord_push(jrec, JTYPE_REDO);
jrecord_pop(jrec, save);
}
}
- jreclist_done(&jreclist, error);
+ jreclist_done(mp, &jreclist, error);
return (error);
}
* Output the write data to the journal.
*/
if (error == 0) {
- TAILQ_FOREACH(jrec, &jreclist, user_entry) {
+ TAILQ_FOREACH(jrec, &jreclist.list, user_entry) {
jrecord_write_cred(jrec, NULL, ap->a_cred);
jrecord_write_vnode_ref(jrec, ap->a_vp);
save = jrecord_push(jrec, JTYPE_REDO);
jrecord_pop(jrec, save);
}
}
- jreclist_done(&jreclist, error);
+ jreclist_done(mp, &jreclist, error);
if (uio_copy.uio_iov != &uio_one_iovec)
free(uio_copy.uio_iov, M_JOURNAL);
}
error = vop_journal_operate_ap(&ap->a_head);
if (error == 0 && ap->a_count > 0) {
- TAILQ_FOREACH(jrec, &jreclist, user_entry) {
+ TAILQ_FOREACH(jrec, &jreclist.list, user_entry) {
jrecord_write_vnode_ref(jrec, ap->a_vp);
save = jrecord_push(jrec, JTYPE_REDO);
jrecord_write_pagelist(jrec, JLEAF_FILEDATA, ap->a_m, ap->a_rtvals,
jrecord_pop(jrec, save);
}
}
- jreclist_done(&jreclist, error);
+ jreclist_done(mp, &jreclist, error);
return (error);
}
jreclist_init(mp, &jreclist, &jreccache, JTYPE_SETACL);
error = vop_journal_operate_ap(&ap->a_head);
if (error == 0) {
- TAILQ_FOREACH(jrec, &jreclist, user_entry) {
+ TAILQ_FOREACH(jrec, &jreclist.list, user_entry) {
#if 0
if ((jo->flags & MC_JOURNAL_WANT_REVERSABLE))
jrecord_undo_file(jrec, ap->a_vp, JRUNDO_XXX, 0, 0);
#endif
}
}
- jreclist_done(&jreclist, error);
+ jreclist_done(mp, &jreclist, error);
return (error);
}
jreclist_init(mp, &jreclist, &jreccache, JTYPE_SETEXTATTR);
error = vop_journal_operate_ap(&ap->a_head);
if (error == 0) {
- TAILQ_FOREACH(jrec, &jreclist, user_entry) {
+ TAILQ_FOREACH(jrec, &jreclist.list, user_entry) {
#if 0
if ((jo->flags & MC_JOURNAL_WANT_REVERSABLE))
jrecord_undo_file(jrec, ap->a_vp, JRUNDO_XXX, 0, 0);
jrecord_pop(jrec, save);
}
}
- jreclist_done(&jreclist, error);
+ jreclist_done(mp, &jreclist, error);
return (error);
}
jreclist_init(mp, &jreclist, &jreccache, JTYPE_CREATE);
error = vop_journal_operate_ap(&ap->a_head);
if (error == 0) {
- TAILQ_FOREACH(jrec, &jreclist, user_entry) {
+ TAILQ_FOREACH(jrec, &jreclist.list, user_entry) {
jrecord_write_cred(jrec, NULL, ap->a_cred);
jrecord_write_path(jrec, JLEAF_PATH1, ap->a_ncp);
if (*ap->a_vpp)
jrecord_pop(jrec, save);
}
}
- jreclist_done(&jreclist, error);
+ jreclist_done(mp, &jreclist, error);
return (error);
}
jreclist_init(mp, &jreclist, &jreccache, JTYPE_MKNOD);
error = vop_journal_operate_ap(&ap->a_head);
if (error == 0) {
- TAILQ_FOREACH(jrec, &jreclist, user_entry) {
+ TAILQ_FOREACH(jrec, &jreclist.list, user_entry) {
jrecord_write_cred(jrec, NULL, ap->a_cred);
jrecord_write_path(jrec, JLEAF_PATH1, ap->a_ncp);
save = jrecord_push(jrec, JTYPE_REDO);
jrecord_write_vnode_ref(jrec, *ap->a_vpp);
}
}
- jreclist_done(&jreclist, error);
+ jreclist_done(mp, &jreclist, error);
return (error);
}
jreclist_init(mp, &jreclist, &jreccache, JTYPE_LINK);
error = vop_journal_operate_ap(&ap->a_head);
if (error == 0) {
- TAILQ_FOREACH(jrec, &jreclist, user_entry) {
+ TAILQ_FOREACH(jrec, &jreclist.list, user_entry) {
jrecord_write_cred(jrec, NULL, ap->a_cred);
jrecord_write_path(jrec, JLEAF_PATH1, ap->a_ncp);
/* XXX PATH to VP and inode number */
jrecord_pop(jrec, save);
}
}
- jreclist_done(&jreclist, error);
+ jreclist_done(mp, &jreclist, error);
return (error);
}
jreclist_init(mp, &jreclist, &jreccache, JTYPE_SYMLINK);
error = vop_journal_operate_ap(&ap->a_head);
if (error == 0) {
- TAILQ_FOREACH(jrec, &jreclist, user_entry) {
+ TAILQ_FOREACH(jrec, &jreclist.list, user_entry) {
jrecord_write_cred(jrec, NULL, ap->a_cred);
jrecord_write_path(jrec, JLEAF_PATH1, ap->a_ncp);
save = jrecord_push(jrec, JTYPE_REDO);
jrecord_write_vnode_ref(jrec, *ap->a_vpp);
}
}
- jreclist_done(&jreclist, error);
+ jreclist_done(mp, &jreclist, error);
return (error);
}
jreclist_init(mp, &jreclist, &jreccache, JTYPE_WHITEOUT);
error = vop_journal_operate_ap(&ap->a_head);
if (error == 0) {
- TAILQ_FOREACH(jrec, &jreclist, user_entry) {
+ TAILQ_FOREACH(jrec, &jreclist.list, user_entry) {
jrecord_write_cred(jrec, NULL, ap->a_cred);
jrecord_write_path(jrec, JLEAF_PATH1, ap->a_ncp);
}
}
- jreclist_done(&jreclist, error);
+ jreclist_done(mp, &jreclist, error);
return (error);
}
}
error = vop_journal_operate_ap(&ap->a_head);
if (error == 0) {
- TAILQ_FOREACH(jrec, &jreclist, user_entry) {
+ TAILQ_FOREACH(jrec, &jreclist.list, user_entry) {
jrecord_write_cred(jrec, NULL, ap->a_cred);
jrecord_write_path(jrec, JLEAF_PATH1, ap->a_ncp);
}
}
- jreclist_done(&jreclist, error);
+ jreclist_done(mp, &jreclist, error);
return (error);
}
jreclist_init(mp, &jreclist, &jreccache, JTYPE_MKDIR);
error = vop_journal_operate_ap(&ap->a_head);
if (error == 0) {
- TAILQ_FOREACH(jrec, &jreclist, user_entry) {
+ TAILQ_FOREACH(jrec, &jreclist.list, user_entry) {
#if 0
if (jo->flags & MC_JOURNAL_WANT_AUDIT) {
jrecord_write_audit(jrec);
jrecord_write_vnode_ref(jrec, *ap->a_vpp);
}
}
- jreclist_done(&jreclist, error);
+ jreclist_done(mp, &jreclist, error);
return (error);
}
}
error = vop_journal_operate_ap(&ap->a_head);
if (error == 0) {
- TAILQ_FOREACH(jrec, &jreclist, user_entry) {
+ TAILQ_FOREACH(jrec, &jreclist.list, user_entry) {
jrecord_write_cred(jrec, NULL, ap->a_cred);
jrecord_write_path(jrec, JLEAF_PATH1, ap->a_ncp);
}
}
- jreclist_done(&jreclist, error);
+ jreclist_done(mp, &jreclist, error);
return (error);
}
}
error = vop_journal_operate_ap(&ap->a_head);
if (error == 0) {
- TAILQ_FOREACH(jrec, &jreclist, user_entry) {
+ TAILQ_FOREACH(jrec, &jreclist.list, user_entry) {
jrecord_write_cred(jrec, NULL, ap->a_cred);
jrecord_write_path(jrec, JLEAF_PATH1, ap->a_fncp);
jrecord_write_path(jrec, JLEAF_PATH2, ap->a_tncp);
}
}
- jreclist_done(&jreclist, error);
+ jreclist_done(mp, &jreclist, error);
return (error);
}
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $DragonFly: src/sys/sys/journal.h,v 1.10 2005/09/07 19:04:16 dillon Exp $
+ * $DragonFly: src/sys/sys/journal.h,v 1.11 2006/05/07 00:24:58 dillon Exp $
*/
#ifndef _SYS_JOURNAL_H_
* 16 byte aligned, not 24 byte aligned, and dead space is not allowed.
* So the pad record must fit into any dead space. THEREFORE, THE TRANSID
* FIELD FOR A PAD RECORD MUST BE IGNORED.
+ *
+ * NOTE: ENDIAN HANDLING. Data records can be in little or big endian form.
+ * The receiver detects the state by observing the 'begmagic' field. Each
+ * direction in a full-duplex connection can be operating with different
+ * endianess. Checksum data is always calculated on the raw record (including
+ * dead space) in a byte-stream fashion, and then converted to the transmit
+ * endianess like everything else. If the receiver's endianess is different
+ * it must convert it back to host normal form to compare it against the
+ * calculated checksum.
*/
struct journal_rawrecbeg {
u_int16_t begmagic; /* recovery scan, endianess detection */
*
* @(#)mount.h 8.21 (Berkeley) 5/20/95
* $FreeBSD: src/sys/sys/mount.h,v 1.89.2.7 2003/04/04 20:35:57 tegge Exp $
- * $DragonFly: src/sys/sys/mount.h,v 1.24 2006/05/06 18:48:52 dillon Exp $
+ * $DragonFly: src/sys/sys/mount.h,v 1.25 2006/05/07 00:24:58 dillon Exp $
*/
#ifndef _SYS_MOUNT_H_
struct namecache *mnt_ncp; /* NCF_MNTPT ncp */
struct journallst mnt_jlist; /* list of active journals */
+ u_int8_t *mnt_jbitmap; /* streamid bitmap */
+ int16_t mnt_streamid; /* last streamid */
};
#endif /* _KERNEL || _KERNEL_STRUCTURES */
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $DragonFly: src/sys/sys/mountctl.h,v 1.10 2005/08/24 20:28:33 dillon Exp $
+ * $DragonFly: src/sys/sys/mountctl.h,v 1.11 2006/05/07 00:24:58 dillon Exp $
*/
#ifndef _SYS_MOUNTCTL_H_
void *user_save;
};
-TAILQ_HEAD(jrecord_list, jrecord);
+struct jrecord_list {
+ TAILQ_HEAD(, jrecord) list;
+ int16_t streamid;
+};
#endif
#endif