stylistic polishing.
This commit is contained in:
parent
76ff6dcf46
commit
ab19cad78e
@ -266,6 +266,7 @@ extern void ffs_rawread_setup(void);
|
|||||||
static __inline void
|
static __inline void
|
||||||
numdirtywakeup(int level)
|
numdirtywakeup(int level)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (numdirtybuffers <= level) {
|
if (numdirtybuffers <= level) {
|
||||||
mtx_lock(&nblock);
|
mtx_lock(&nblock);
|
||||||
if (needsbuffer & VFS_BIO_NEED_DIRTYFLUSH) {
|
if (needsbuffer & VFS_BIO_NEED_DIRTYFLUSH) {
|
||||||
@ -288,6 +289,7 @@ numdirtywakeup(int level)
|
|||||||
static __inline void
|
static __inline void
|
||||||
bufspacewakeup(void)
|
bufspacewakeup(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If someone is waiting for BUF space, wake them up. Even
|
* If someone is waiting for BUF space, wake them up. Even
|
||||||
* though we haven't freed the kva space yet, the waiting
|
* though we haven't freed the kva space yet, the waiting
|
||||||
@ -308,6 +310,7 @@ bufspacewakeup(void)
|
|||||||
static __inline void
|
static __inline void
|
||||||
runningbufwakeup(struct buf *bp)
|
runningbufwakeup(struct buf *bp)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (bp->b_runningbufspace) {
|
if (bp->b_runningbufspace) {
|
||||||
atomic_subtract_int(&runningbufspace, bp->b_runningbufspace);
|
atomic_subtract_int(&runningbufspace, bp->b_runningbufspace);
|
||||||
bp->b_runningbufspace = 0;
|
bp->b_runningbufspace = 0;
|
||||||
@ -332,6 +335,7 @@ runningbufwakeup(struct buf *bp)
|
|||||||
static __inline void
|
static __inline void
|
||||||
bufcountwakeup(void)
|
bufcountwakeup(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
atomic_add_int(&numfreebuffers, 1);
|
atomic_add_int(&numfreebuffers, 1);
|
||||||
mtx_lock(&nblock);
|
mtx_lock(&nblock);
|
||||||
if (needsbuffer) {
|
if (needsbuffer) {
|
||||||
@ -361,6 +365,7 @@ bufcountwakeup(void)
|
|||||||
static __inline void
|
static __inline void
|
||||||
waitrunningbufspace(void)
|
waitrunningbufspace(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
mtx_lock(&rbreqlock);
|
mtx_lock(&rbreqlock);
|
||||||
while (runningbufspace > hirunningspace) {
|
while (runningbufspace > hirunningspace) {
|
||||||
++runningbufreq;
|
++runningbufreq;
|
||||||
@ -383,6 +388,7 @@ vfs_buf_test_cache(struct buf *bp,
|
|||||||
vm_ooffset_t foff, vm_offset_t off, vm_offset_t size,
|
vm_ooffset_t foff, vm_offset_t off, vm_offset_t size,
|
||||||
vm_page_t m)
|
vm_page_t m)
|
||||||
{
|
{
|
||||||
|
|
||||||
GIANT_REQUIRED;
|
GIANT_REQUIRED;
|
||||||
|
|
||||||
VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED);
|
VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED);
|
||||||
@ -398,6 +404,7 @@ static __inline
|
|||||||
void
|
void
|
||||||
bd_wakeup(int dirtybuflevel)
|
bd_wakeup(int dirtybuflevel)
|
||||||
{
|
{
|
||||||
|
|
||||||
mtx_lock(&bdlock);
|
mtx_lock(&bdlock);
|
||||||
if (bd_request == 0 && numdirtybuffers >= dirtybuflevel) {
|
if (bd_request == 0 && numdirtybuffers >= dirtybuflevel) {
|
||||||
bd_request = 1;
|
bd_request = 1;
|
||||||
@ -414,6 +421,7 @@ static __inline
|
|||||||
void
|
void
|
||||||
bd_speedup(void)
|
bd_speedup(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
bd_wakeup(1);
|
bd_wakeup(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -426,6 +434,7 @@ bd_speedup(void)
|
|||||||
caddr_t
|
caddr_t
|
||||||
kern_vfs_bio_buffer_alloc(caddr_t v, long physmem_est)
|
kern_vfs_bio_buffer_alloc(caddr_t v, long physmem_est)
|
||||||
{
|
{
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* physmem_est is in pages. Convert it to kilobytes (assumes
|
* physmem_est is in pages. Convert it to kilobytes (assumes
|
||||||
* PAGE_SIZE is >= 1K)
|
* PAGE_SIZE is >= 1K)
|
||||||
@ -605,6 +614,7 @@ bufinit(void)
|
|||||||
static void
|
static void
|
||||||
bfreekva(struct buf *bp)
|
bfreekva(struct buf *bp)
|
||||||
{
|
{
|
||||||
|
|
||||||
GIANT_REQUIRED;
|
GIANT_REQUIRED;
|
||||||
|
|
||||||
if (bp->b_kvasize) {
|
if (bp->b_kvasize) {
|
||||||
@ -627,6 +637,7 @@ bfreekva(struct buf * bp)
|
|||||||
void
|
void
|
||||||
bremfree(struct buf *bp)
|
bremfree(struct buf *bp)
|
||||||
{
|
{
|
||||||
|
|
||||||
mtx_lock(&bqlock);
|
mtx_lock(&bqlock);
|
||||||
bremfreel(bp);
|
bremfreel(bp);
|
||||||
mtx_unlock(&bqlock);
|
mtx_unlock(&bqlock);
|
||||||
@ -918,8 +929,7 @@ ibwrite(struct buf * bp)
|
|||||||
* Complete a background write started from bwrite.
|
* Complete a background write started from bwrite.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
vfs_backgroundwritedone(bp)
|
vfs_backgroundwritedone(struct buf *bp)
|
||||||
struct buf *bp;
|
|
||||||
{
|
{
|
||||||
struct buf *origbp;
|
struct buf *origbp;
|
||||||
|
|
||||||
@ -1099,9 +1109,9 @@ bdwrite(struct buf * bp)
|
|||||||
* The buffer must be on QUEUE_NONE.
|
* The buffer must be on QUEUE_NONE.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
bdirty(bp)
|
bdirty(struct buf *bp)
|
||||||
struct buf *bp;
|
|
||||||
{
|
{
|
||||||
|
|
||||||
KASSERT(bp->b_qindex == QUEUE_NONE,
|
KASSERT(bp->b_qindex == QUEUE_NONE,
|
||||||
("bdirty: buffer %p still on queue %d", bp, bp->b_qindex));
|
("bdirty: buffer %p still on queue %d", bp, bp->b_qindex));
|
||||||
bp->b_flags &= ~(B_RELBUF);
|
bp->b_flags &= ~(B_RELBUF);
|
||||||
@ -1128,9 +1138,9 @@ bdirty(bp)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
bundirty(bp)
|
bundirty(struct buf *bp)
|
||||||
struct buf *bp;
|
|
||||||
{
|
{
|
||||||
|
|
||||||
KASSERT(bp->b_qindex == QUEUE_NONE,
|
KASSERT(bp->b_qindex == QUEUE_NONE,
|
||||||
("bundirty: buffer %p still on queue %d", bp, bp->b_qindex));
|
("bundirty: buffer %p still on queue %d", bp, bp->b_qindex));
|
||||||
|
|
||||||
@ -1158,6 +1168,7 @@ bundirty(bp)
|
|||||||
void
|
void
|
||||||
bawrite(struct buf *bp)
|
bawrite(struct buf *bp)
|
||||||
{
|
{
|
||||||
|
|
||||||
bp->b_flags |= B_ASYNC;
|
bp->b_flags |= B_ASYNC;
|
||||||
(void) bwrite(bp);
|
(void) bwrite(bp);
|
||||||
}
|
}
|
||||||
@ -1175,6 +1186,7 @@ bawrite(struct buf * bp)
|
|||||||
void
|
void
|
||||||
bwillwrite(void)
|
bwillwrite(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (numdirtybuffers >= hidirtybuffers) {
|
if (numdirtybuffers >= hidirtybuffers) {
|
||||||
int s;
|
int s;
|
||||||
|
|
||||||
@ -1199,6 +1211,7 @@ bwillwrite(void)
|
|||||||
int
|
int
|
||||||
buf_dirty_count_severe(void)
|
buf_dirty_count_severe(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
return(numdirtybuffers >= hidirtybuffers);
|
return(numdirtybuffers >= hidirtybuffers);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1357,11 +1370,13 @@ brelse(struct buf * bp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((bp->b_flags & B_INVAL) == 0) {
|
if ((bp->b_flags & B_INVAL) == 0) {
|
||||||
pmap_qenter(trunc_page((vm_offset_t)bp->b_data), bp->b_pages, bp->b_npages);
|
pmap_qenter(
|
||||||
|
trunc_page((vm_offset_t)bp->b_data), bp->b_pages, bp->b_npages);
|
||||||
}
|
}
|
||||||
m = bp->b_pages[i];
|
m = bp->b_pages[i];
|
||||||
}
|
}
|
||||||
if ((bp->b_flags & B_NOCACHE) || (bp->b_ioflags & BIO_ERROR)) {
|
if ((bp->b_flags & B_NOCACHE) ||
|
||||||
|
(bp->b_ioflags & BIO_ERROR)) {
|
||||||
int poffset = foff & PAGE_MASK;
|
int poffset = foff & PAGE_MASK;
|
||||||
int presid = resid > (PAGE_SIZE - poffset) ?
|
int presid = resid > (PAGE_SIZE - poffset) ?
|
||||||
(PAGE_SIZE - poffset) : resid;
|
(PAGE_SIZE - poffset) : resid;
|
||||||
@ -1491,7 +1506,8 @@ bqrelse(struct buf * bp)
|
|||||||
|
|
||||||
s = splbio();
|
s = splbio();
|
||||||
|
|
||||||
KASSERT(!(bp->b_flags & (B_CLUSTER|B_PAGING)), ("bqrelse: inappropriate B_PAGING or B_CLUSTER bp %p", bp));
|
KASSERT(!(bp->b_flags & (B_CLUSTER|B_PAGING)),
|
||||||
|
("bqrelse: inappropriate B_PAGING or B_CLUSTER bp %p", bp));
|
||||||
|
|
||||||
if (bp->b_qindex != QUEUE_NONE)
|
if (bp->b_qindex != QUEUE_NONE)
|
||||||
panic("bqrelse: free buffer onto another queue???");
|
panic("bqrelse: free buffer onto another queue???");
|
||||||
@ -1552,8 +1568,7 @@ bqrelse(struct buf * bp)
|
|||||||
|
|
||||||
/* Give pages used by the bp back to the VM system (where possible) */
|
/* Give pages used by the bp back to the VM system (where possible) */
|
||||||
static void
|
static void
|
||||||
vfs_vmio_release(bp)
|
vfs_vmio_release(struct buf *bp)
|
||||||
struct buf *bp;
|
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
vm_page_t m;
|
vm_page_t m;
|
||||||
@ -2139,6 +2154,7 @@ buf_daemon()
|
|||||||
int flushwithdeps = 0;
|
int flushwithdeps = 0;
|
||||||
SYSCTL_INT(_vfs, OID_AUTO, flushwithdeps, CTLFLAG_RW, &flushwithdeps,
|
SYSCTL_INT(_vfs, OID_AUTO, flushwithdeps, CTLFLAG_RW, &flushwithdeps,
|
||||||
0, "Number of buffers flushed with dependecies that require rollbacks");
|
0, "Number of buffers flushed with dependecies that require rollbacks");
|
||||||
|
|
||||||
static int
|
static int
|
||||||
flushbufqueues(int flushdeps)
|
flushbufqueues(int flushdeps)
|
||||||
{
|
{
|
||||||
@ -2992,6 +3008,7 @@ allocbuf(struct buf *bp, int size)
|
|||||||
void
|
void
|
||||||
biodone(struct bio *bp)
|
biodone(struct bio *bp)
|
||||||
{
|
{
|
||||||
|
|
||||||
mtx_lock(&bdonelock);
|
mtx_lock(&bdonelock);
|
||||||
bp->bio_flags |= BIO_DONE;
|
bp->bio_flags |= BIO_DONE;
|
||||||
if (bp->bio_done == NULL)
|
if (bp->bio_done == NULL)
|
||||||
@ -3043,7 +3060,7 @@ biofinish(struct bio *bp, struct devstat *stat, int error)
|
|||||||
* error and cleared.
|
* error and cleared.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
bufwait(register struct buf * bp)
|
bufwait(struct buf *bp)
|
||||||
{
|
{
|
||||||
int s;
|
int s;
|
||||||
|
|
||||||
@ -3477,6 +3494,7 @@ vfs_clean_pages(struct buf * bp)
|
|||||||
void
|
void
|
||||||
vfs_bio_set_validclean(struct buf *bp, int base, int size)
|
vfs_bio_set_validclean(struct buf *bp, int base, int size)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (bp->b_flags & B_VMIO) {
|
if (bp->b_flags & B_VMIO) {
|
||||||
int i;
|
int i;
|
||||||
int n;
|
int n;
|
||||||
@ -3685,8 +3703,9 @@ vmapbuf(struct buf *bp)
|
|||||||
|
|
||||||
if (bp->b_bufsize < 0)
|
if (bp->b_bufsize < 0)
|
||||||
return (-1);
|
return (-1);
|
||||||
prot = (bp->b_iocmd == BIO_READ) ? VM_PROT_READ | VM_PROT_WRITE :
|
prot = VM_PROT_READ;
|
||||||
VM_PROT_READ;
|
if (bp->b_iocmd == BIO_READ)
|
||||||
|
prot |= VM_PROT_WRITE; /* Less backwards than it looks */
|
||||||
for (addr = (caddr_t)trunc_page((vm_offset_t)bp->b_data), pidx = 0;
|
for (addr = (caddr_t)trunc_page((vm_offset_t)bp->b_data), pidx = 0;
|
||||||
addr < bp->b_data + bp->b_bufsize;
|
addr < bp->b_data + bp->b_bufsize;
|
||||||
addr += PAGE_SIZE, pidx++) {
|
addr += PAGE_SIZE, pidx++) {
|
||||||
@ -3736,8 +3755,7 @@ vunmapbuf(struct buf *bp)
|
|||||||
int npages;
|
int npages;
|
||||||
|
|
||||||
npages = bp->b_npages;
|
npages = bp->b_npages;
|
||||||
pmap_qremove(trunc_page((vm_offset_t)bp->b_data),
|
pmap_qremove(trunc_page((vm_offset_t)bp->b_data), npages);
|
||||||
npages);
|
|
||||||
vm_page_lock_queues();
|
vm_page_lock_queues();
|
||||||
for (pidx = 0; pidx < npages; pidx++)
|
for (pidx = 0; pidx < npages; pidx++)
|
||||||
vm_page_unhold(bp->b_pages[pidx]);
|
vm_page_unhold(bp->b_pages[pidx]);
|
||||||
@ -3749,6 +3767,7 @@ vunmapbuf(struct buf *bp)
|
|||||||
void
|
void
|
||||||
bdone(struct buf *bp)
|
bdone(struct buf *bp)
|
||||||
{
|
{
|
||||||
|
|
||||||
mtx_lock(&bdonelock);
|
mtx_lock(&bdonelock);
|
||||||
bp->b_flags |= B_DONE;
|
bp->b_flags |= B_DONE;
|
||||||
wakeup(bp);
|
wakeup(bp);
|
||||||
@ -3758,6 +3777,7 @@ bdone(struct buf *bp)
|
|||||||
void
|
void
|
||||||
bwait(struct buf *bp, u_char pri, const char *wchan)
|
bwait(struct buf *bp, u_char pri, const char *wchan)
|
||||||
{
|
{
|
||||||
|
|
||||||
mtx_lock(&bdonelock);
|
mtx_lock(&bdonelock);
|
||||||
while ((bp->b_flags & B_DONE) == 0)
|
while ((bp->b_flags & B_DONE) == 0)
|
||||||
msleep(bp, &bdonelock, pri, wchan, 0);
|
msleep(bp, &bdonelock, pri, wchan, 0);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user