Synchronize access to the vm page's PG_BUSY flag using the containing vm

object's lock.  In the same place, eliminate unnecessary checks for a NULL
vm object pointer.
This commit is contained in:
Alan Cox 2004-10-27 02:05:00 +00:00
parent 58562ff20c
commit df9f17c3df
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=136985

View File

@ -927,17 +927,18 @@ cluster_wbuild(vp, size, start_lbn, len)
if (tbp->b_flags & B_VMIO) {
vm_page_t m;
VM_OBJECT_LOCK(tbp->b_object);
if (i != 0) { /* if not first buffer */
for (j = 0; j < tbp->b_npages; j += 1) {
m = tbp->b_pages[j];
if (m->flags & PG_BUSY) {
VM_OBJECT_UNLOCK(
tbp->b_object);
bqrelse(tbp);
goto finishcluster;
}
}
}
if (tbp->b_object != NULL)
VM_OBJECT_LOCK(tbp->b_object);
vm_page_lock_queues();
for (j = 0; j < tbp->b_npages; j += 1) {
m = tbp->b_pages[j];
@ -950,8 +951,7 @@ cluster_wbuild(vp, size, start_lbn, len)
}
}
vm_page_unlock_queues();
if (tbp->b_object != NULL)
VM_OBJECT_UNLOCK(tbp->b_object);
VM_OBJECT_UNLOCK(tbp->b_object);
}
bp->b_bcount += size;
bp->b_bufsize += size;