Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern Use correct offset to block number calculations.
details: https://anonhg.NetBSD.org/src/rev/c2289b6d9085
branches: trunk
changeset: 752335:c2289b6d9085
user: mlelstv <mlelstv%NetBSD.org@localhost>
date: Tue Feb 23 20:51:25 2010 +0000
description:
Use correct offset to block number calculations.
Also change access to filesystem blocks to be done by fragment instead
of by physical block. Fragments are the fundamental blocks of the
filesystem.
For a theoretical filesystem that accesses the disk in smaller units
than stored in mp->mnt_fs_bshift, the assumption might be wrong. But
this will also break other subsystems. The value mp->mnt_dev_bshift
which formerly represents the physical sector size is currently only
virtual in NetBSD (always DEV_BSIZE).
diffstat:
sys/kern/vfs_wapbl.c | 15 ++++++++-------
1 files changed, 8 insertions(+), 7 deletions(-)
diffs (59 lines):
diff -r a74f5005f298 -r c2289b6d9085 sys/kern/vfs_wapbl.c
--- a/sys/kern/vfs_wapbl.c Tue Feb 23 20:42:40 2010 +0000
+++ b/sys/kern/vfs_wapbl.c Tue Feb 23 20:51:25 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vfs_wapbl.c,v 1.30 2010/02/06 12:10:59 uebayasi Exp $ */
+/* $NetBSD: vfs_wapbl.c,v 1.31 2010/02/23 20:51:25 mlelstv Exp $ */
/*-
* Copyright (c) 2003, 2008, 2009 The NetBSD Foundation, Inc.
@@ -36,9 +36,10 @@
#define WAPBL_INTERNAL
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_wapbl.c,v 1.30 2010/02/06 12:10:59 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_wapbl.c,v 1.31 2010/02/23 20:51:25 mlelstv Exp $");
#include <sys/param.h>
+#include <sys/bitops.h>
#ifdef _KERNEL
#include <sys/param.h>
@@ -317,8 +318,8 @@
struct vnode *devvp;
daddr_t logpbn;
int error;
- int log_dev_bshift = DEV_BSHIFT;
- int fs_dev_bshift = DEV_BSHIFT;
+ int log_dev_bshift = ilog2(blksize);
+ int fs_dev_bshift = mp->mnt_fs_bshift; /* XXX */
int run;
WAPBL_PRINTF(WAPBL_PRINT_OPEN, ("wapbl_start: vp=%p off=%" PRId64
@@ -744,7 +745,7 @@
slen = wl->wl_circ_off + wl->wl_circ_size - off;
if (slen < len) {
error = wapbl_write(data, slen, wl->wl_devvp,
- wl->wl_logpbn + (off >> wl->wl_log_dev_bshift));
+ wl->wl_logpbn + btodb(off));
if (error)
return error;
data = (uint8_t *)data + slen;
@@ -752,7 +753,7 @@
off = wl->wl_circ_off;
}
error = wapbl_write(data, len, wl->wl_devvp,
- wl->wl_logpbn + (off >> wl->wl_log_dev_bshift));
+ wl->wl_logpbn + btodb(off));
if (error)
return error;
off += len;
@@ -2239,7 +2240,7 @@
struct wapbl_wc_header *wch;
struct wapbl_wc_header *wch2;
/* Use this until we read the actual log header */
- int log_dev_bshift = DEV_BSHIFT;
+ int log_dev_bshift = ilog2(blksize);
size_t used;
WAPBL_PRINTF(WAPBL_PRINT_REPLAY,
Home |
Main Index |
Thread Index |
Old Index