Created
August 27, 2017 22:39
-
-
Save macdice/873cda3af78b615f41647a161286ba8d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/sys/ufs/ffs/ffs_vnops.c b/sys/ufs/ffs/ffs_vnops.c | |
index f5a45f1..50296f7 100644 | |
--- a/sys/ufs/ffs/ffs_vnops.c | |
+++ b/sys/ufs/ffs/ffs_vnops.c | |
@@ -218,6 +218,29 @@ retry: | |
} | |
int | |
+ffs_sync_file_range(struct vnode *vp, off_t begin, size_t size) | |
+{ | |
+ struct buf *bp, *nbp; | |
+ struct bufobj *bo = &vp->v_bufobj; | |
+ off_t past_end = begin + size; | |
+ | |
+ /* | |
+ * Walk the dirty buffer list looking for buffers that overlap the given | |
+ * range, and request asynchronous write-back. | |
+ */ | |
+ BO_LOCK(bo); | |
+ TAILQ_FOREACH_SAFE(bp, &bo->dirty.bv_hd, b_objufs, nbp) { | |
+ if (bp->b_offset + bp->bufsize > begin && bp->b_offset < past_end) { | |
+ bremfree(bp); | |
+ (void) bawrite(bp); | |
+ } | |
+ } | |
+ BO_UNLOCK(bo); | |
+ | |
+ return (0); | |
+} | |
+ | |
+int | |
ffs_syncvnode(struct vnode *vp, int waitfor, int flags) | |
{ | |
struct inode *ip; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment