svn commit: r329078 - in head/sys: kern sys
Kirk McKusick
mckusick at FreeBSD.org
Fri Feb 9 19:50:48 UTC 2018
Author: mckusick
Date: Fri Feb 9 19:50:47 2018
New Revision: 329078
URL: https://svnweb.freebsd.org/changeset/base/329078
Log:
Merge biodone_finish() back into biodone(). The primary purpose is
to make the order of operations clearer to avoid the race condition
that was fixed in r328914. In particular, this commit corrects a
similar race that existed in the soft updates callback.
Doing some sleuthing through the SVN repository, it appears that
bufdone_finish() was added to support XFS:
------------------------------------------------------------------------
r153192 | rodrigc | 2005-12-06 19:39:08 -0800 (Tue, 06 Dec 2005) | 13 lines
Changes imported from XFS for FreeBSD project:
- add fields to struct buf (needed by XFS)
- 3 private fields: b_fsprivate1, b_fsprivate2, b_fsprivate3
- b_pin_count, count of pinned buffer
- add new B_MANAGED flag
- add breada() function to initiate asynchronous I/O on read-ahead blocks.
- add bufdone_finish(), bpin(), bunpin_wait() functions
Patches provided by: kan
Reviewed by: phk
Silence on: arch@
------------------------------------------------------------------------
It does not appear to ever have been used for anything else. XFS was
disconnected in r241607:
------------------------------------------------------------------------
r241607 | attilio | 2012-10-16 03:04:00 -0700 (Tue, 16 Oct 2012) | 5 lines
Disconnect non-MPSAFE XFS from the build in preparation for dropping
GIANT from VFS.
This is not targeted for MFC.
------------------------------------------------------------------------
and removed entirely in r247631:
------------------------------------------------------------------------
r247631 | attilio | 2013-03-02 07:33:54 -0800 (Sat, 02 Mar 2013) | 5 lines
Garbage collect XFS bits which are now already completely disconnected
from the tree since few months.
This is not targeted for MFC.
------------------------------------------------------------------------
Since XFS support is gone, there is no reason to retain biodone_finish().
Suggested by: Warner Losh (imp)
Discussed with: cem, kib
Tested by: Peter Holm (pho)
Modified:
head/sys/kern/vfs_bio.c
head/sys/sys/buf.h
Modified: head/sys/kern/vfs_bio.c
==============================================================================
--- head/sys/kern/vfs_bio.c Fri Feb 9 19:46:51 2018 (r329077)
+++ head/sys/kern/vfs_bio.c Fri Feb 9 19:50:47 2018 (r329078)
@@ -4086,21 +4086,6 @@ bufdone(struct buf *bp)
bufobj_wdrop(dropobj);
return;
}
-
- bufdone_finish(bp);
-
- if (dropobj)
- bufobj_wdrop(dropobj);
-}
-
-void
-bufdone_finish(struct buf *bp)
-{
- BUF_ASSERT_HELD(bp);
-
- if (!LIST_EMPTY(&bp->b_dep))
- buf_complete(bp);
-
if (bp->b_flags & B_VMIO) {
/*
* Set B_CACHE if the op was a normal read and no error
@@ -4113,14 +4098,14 @@ bufdone_finish(struct buf *bp)
bp->b_flags |= B_CACHE;
vfs_vmio_iodone(bp);
}
+ if (!LIST_EMPTY(&bp->b_dep))
+ buf_complete(bp);
if ((bp->b_flags & B_CKHASH) != 0) {
KASSERT(bp->b_iocmd == BIO_READ,
- ("bufdone_finish: b_iocmd %d not BIO_READ", bp->b_iocmd));
- KASSERT(buf_mapped(bp),
- ("bufdone_finish: bp %p not mapped", bp));
+ ("bufdone: b_iocmd %d not BIO_READ", bp->b_iocmd));
+ KASSERT(buf_mapped(bp), ("bufdone: bp %p not mapped", bp));
(*bp->b_ckhashcalc)(bp);
}
-
/*
* For asynchronous completions, release the buffer now. The brelse
* will do a wakeup there if necessary - so no need to do a wakeup
@@ -4134,6 +4119,8 @@ bufdone_finish(struct buf *bp)
bqrelse(bp);
} else
bdone(bp);
+ if (dropobj)
+ bufobj_wdrop(dropobj);
}
/*
Modified: head/sys/sys/buf.h
==============================================================================
--- head/sys/sys/buf.h Fri Feb 9 19:46:51 2018 (r329077)
+++ head/sys/sys/buf.h Fri Feb 9 19:50:47 2018 (r329078)
@@ -542,7 +542,6 @@ struct buf *geteblk(int, int);
int bufwait(struct buf *);
int bufwrite(struct buf *);
void bufdone(struct buf *);
-void bufdone_finish(struct buf *);
void bd_speedup(void);
int cluster_read(struct vnode *, u_quad_t, daddr_t, long,
More information about the svn-src-all
mailing list