/* Releases the lock on the buffer object. If the buffer is marked delwri but is not queued, do so before we unlock the buffer as we need to set flags correctly. We also need to take a reference for the delwri queue because the unlocker is going to drop their's and they don't know we just queued it.  */
void xfs_buf_unlock(xfs_buf_t *bp)
/* Releases the lock on the buffer object. If the buffer is marked delwri but is not queued, do so before we unlock the buffer as we need to set flags correctly. We also need to take a reference for the delwri queue because the unlocker is going to drop their's and they don't know we just queued it.  */
void xfs_buf_unlock(xfs_buf_t *bp)
{
	if ((bp->b_flags & (XBF_DELWRI|_XBF_DELWRI_Q)) == XBF_DELWRI) {
		atomic_inc(&bp->b_hold);
		bp->b_flags |= XBF_ASYNC;
		xfs_buf_delwri_queue(bp, 0);
	}
	XB_CLEAR_OWNER(bp);
	up(&bp->b_sema);
	trace_xfs_buf_unlock(bp, _RET_IP_);
}