fsync() device fd if doing a non-B_ASYNC write. This makes the

file system safe, but less performant as the kernel, as it syncs
*all* outstanding dirty buffers.  However, we don't have much choice
in userspace currently.
This commit is contained in:
pooka 2007-09-20 23:43:44 +00:00
parent d0ee80aad0
commit b795ecbe79
3 changed files with 16 additions and 4 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: specfs.c,v 1.7 2007/09/10 19:11:44 pooka Exp $ */
/* $NetBSD: specfs.c,v 1.8 2007/09/20 23:43:44 pooka Exp $ */
/*
* Copyright (c) 2007 Antti Kantee. All Rights Reserved.
@ -203,9 +203,13 @@ rump_specstrategy(void *v)
if (bp->b_flags & B_READ)
rv = rumpuser_pread(sp->rsp_fd, bp->b_data, bp->b_bcount,
off, &error);
else
else {
int dummy;
rv = rumpuser_pwrite(sp->rsp_fd, bp->b_data, bp->b_bcount,
off, &error);
if ((bp->b_flags & B_ASYNC) == 0)
rumpuser_fsync(sp->rsp_fd, &dummy);
}
bp->b_error = 0;
if (rv == -1)

View File

@ -1,4 +1,4 @@
/* $NetBSD: rumpuser.c,v 1.7 2007/09/10 19:11:45 pooka Exp $ */
/* $NetBSD: rumpuser.c,v 1.8 2007/09/20 23:43:45 pooka Exp $ */
/*
* Copyright (c) 2007 Antti Kantee. All Rights Reserved.
@ -145,6 +145,13 @@ rumpuser_close(int fd, int *error)
DOCALL(int, close(fd));
}
int
rumpuser_fsync(int fd, int *error)
{
DOCALL(int, fsync(fd));
}
ssize_t
rumpuser_pread(int fd, void *data, size_t size, off_t offset, int *error)
{

View File

@ -1,4 +1,4 @@
/* $NetBSD: rumpuser.h,v 1.5 2007/09/10 19:11:45 pooka Exp $ */
/* $NetBSD: rumpuser.h,v 1.6 2007/09/20 23:43:45 pooka Exp $ */
/*
* Copyright (c) 2007 Antti Kantee. All Rights Reserved.
@ -46,6 +46,7 @@ void rumpuser_free(void *);
int rumpuser_open(const char *, int, int *);
int rumpuser_ioctl(int, u_long, void *, int *);
int rumpuser_close(int, int *);
int rumpuser_fsync(int, int *);
ssize_t rumpuser_pread(int, void *, size_t, off_t, int *);
ssize_t rumpuser_pwrite(int, const void *, size_t, off_t, int *);