diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c index 0965f2747d78..526429d02f45 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -981,7 +981,7 @@ bdwrite(struct buf * bp) */ vp = bp->b_vp; VI_LOCK(vp); - if (td->td_proc->p_flag & P_COWINPROGRESS) { + if (td->td_pflags & TDP_COWINPROGRESS) { recursiveflushes++; } else if (vp != NULL && vp->v_dirtybufcnt > dirtybufthresh + 10) { VI_UNLOCK(vp); diff --git a/sys/sys/proc.h b/sys/sys/proc.h index 2ff8a0bc6b51..dbea7e954ab1 100644 --- a/sys/sys/proc.h +++ b/sys/sys/proc.h @@ -358,6 +358,7 @@ struct thread { #define TDP_INKTR 0x0002 /* Thread is currently in KTR code. */ #define TDP_INKTRACE 0x0004 /* Thread is currently in KTRACE code. */ #define TDP_UPCALLING 0x0008 /* This thread is doing an upcall. */ +#define TDP_COWINPROGRESS 0x0010 /* Snapshot copy-on-write in progress. */ #define TDI_SUSPENDED 0x0001 /* On suspension queue. */ #define TDI_SLEEPING 0x0002 /* Actually asleep! (tricky). */ @@ -641,8 +642,6 @@ struct proc { /* (not to user) */ #define P_PROTECTED 0x100000 /* Do not kill on memory overcommit. */ #define P_SIGEVENT 0x200000 /* Process pending signals changed */ -/* Should be moved to machine-dependent areas. */ -#define P_COWINPROGRESS 0x400000 /* Snapshot copy-on-write in progress. */ #define P_JAILED 0x1000000 /* Process is in jail. */ #define P_ALTSTACK 0x2000000 /* Have alternate signal stack. */ diff --git a/sys/ufs/ffs/ffs_snapshot.c b/sys/ufs/ffs/ffs_snapshot.c index b3b54d1dcd49..cd50ece13e9d 100644 --- a/sys/ufs/ffs/ffs_snapshot.c +++ b/sys/ufs/ffs/ffs_snapshot.c @@ -822,10 +822,10 @@ expunge_ufs1(snapvp, cancelip, fs, acctfunc, expungetype) if (lbn < NDADDR) { blkno = VTOI(snapvp)->i_din1->di_db[lbn]; } else { - td->td_proc->p_flag |= P_COWINPROGRESS; + td->td_pflags |= TDP_COWINPROGRESS; error = UFS_BALLOC(snapvp, lblktosize(fs, (off_t)lbn), fs->fs_bsize, KERNCRED, BA_METAONLY, &bp); - td->td_proc->p_flag &= ~P_COWINPROGRESS; + td->td_pflags &= ~TDP_COWINPROGRESS; if (error) return (error); indiroff = (lbn - NDADDR) % NINDIR(fs); @@ -1102,10 +1102,10 @@ expunge_ufs2(snapvp, cancelip, fs, acctfunc, expungetype) if (lbn < NDADDR) { blkno = VTOI(snapvp)->i_din2->di_db[lbn]; } else { - td->td_proc->p_flag |= P_COWINPROGRESS; + td->td_pflags |= TDP_COWINPROGRESS; error = UFS_BALLOC(snapvp, lblktosize(fs, (off_t)lbn), fs->fs_bsize, KERNCRED, BA_METAONLY, &bp); - td->td_proc->p_flag &= ~P_COWINPROGRESS; + td->td_pflags &= ~TDP_COWINPROGRESS; if (error) return (error); indiroff = (lbn - NDADDR) % NINDIR(fs); @@ -1552,10 +1552,10 @@ ffs_snapblkfree(fs, devvp, bno, size, inum) VI_MTX(devvp), td) != 0) goto retry; snapshot_locked = 1; - td->td_proc->p_flag |= P_COWINPROGRESS; + td->td_pflags |= TDP_COWINPROGRESS; error = UFS_BALLOC(vp, lblktosize(fs, (off_t)lbn), fs->fs_bsize, KERNCRED, BA_METAONLY, &ibp); - td->td_proc->p_flag &= ~P_COWINPROGRESS; + td->td_pflags &= ~TDP_COWINPROGRESS; if (error) break; indiroff = (lbn - NDADDR) % NINDIR(fs); @@ -1659,10 +1659,10 @@ ffs_snapblkfree(fs, devvp, bno, size, inum) * allocation will never require any additional allocations for * the snapshot inode. */ - td->td_proc->p_flag |= P_COWINPROGRESS; + td->td_pflags |= TDP_COWINPROGRESS; error = UFS_BALLOC(vp, lblktosize(fs, (off_t)lbn), fs->fs_bsize, KERNCRED, 0, &cbp); - td->td_proc->p_flag &= ~P_COWINPROGRESS; + td->td_pflags &= ~TDP_COWINPROGRESS; if (error) break; #ifdef DEBUG @@ -1930,7 +1930,7 @@ ffs_copyonwrite(devvp, bp) ufs2_daddr_t lbn, blkno, *snapblklist; int lower, upper, mid, indiroff, snapshot_locked = 0, error = 0; - if (td->td_proc->p_flag & P_COWINPROGRESS) + if (td->td_pflags & TDP_COWINPROGRESS) panic("ffs_copyonwrite: recursive call"); /* * First check to see if it is in the preallocated list. @@ -1988,10 +1988,10 @@ ffs_copyonwrite(devvp, bp) goto retry; } snapshot_locked = 1; - td->td_proc->p_flag |= P_COWINPROGRESS; + td->td_pflags |= TDP_COWINPROGRESS; error = UFS_BALLOC(vp, lblktosize(fs, (off_t)lbn), fs->fs_bsize, KERNCRED, BA_METAONLY, &ibp); - td->td_proc->p_flag &= ~P_COWINPROGRESS; + td->td_pflags &= ~TDP_COWINPROGRESS; if (error) break; indiroff = (lbn - NDADDR) % NINDIR(fs); @@ -2025,10 +2025,10 @@ ffs_copyonwrite(devvp, bp) goto retry; } snapshot_locked = 1; - td->td_proc->p_flag |= P_COWINPROGRESS; + td->td_pflags |= TDP_COWINPROGRESS; error = UFS_BALLOC(vp, lblktosize(fs, (off_t)lbn), fs->fs_bsize, KERNCRED, 0, &cbp); - td->td_proc->p_flag &= ~P_COWINPROGRESS; + td->td_pflags &= ~TDP_COWINPROGRESS; if (error) break; #ifdef DEBUG diff --git a/sys/ufs/ffs/ffs_softdep.c b/sys/ufs/ffs/ffs_softdep.c index 768a6b536ea8..3ebe427ffdf9 100644 --- a/sys/ufs/ffs/ffs_softdep.c +++ b/sys/ufs/ffs/ffs_softdep.c @@ -688,7 +688,7 @@ process_worklist_item(matchmnt, flags) * copy-on-write, then it is not safe to write as we may * recurse into the copy-on-write routine. */ - if (curthread->td_proc->p_flag & P_COWINPROGRESS) + if (curthread->td_pflags & TDP_COWINPROGRESS) return (-1); ACQUIRE_LOCK(&lk); /* @@ -5479,7 +5479,7 @@ softdep_request_cleanup(fs, vp) * copy-on-write, then it is not safe to update the vnode * as we may recurse into the copy-on-write routine. */ - if ((curthread->td_proc->p_flag & P_COWINPROGRESS) == 0 && + if (!(curthread->td_pflags & TDP_COWINPROGRESS) && UFS_UPDATE(vp, 1) != 0) return (0); while (fs->fs_pendingblocks > 0 && fs->fs_cstotal.cs_nbfree <= needed) {