Module Name: src Committed By: mlelstv Date: Tue Feb 23 20:51:26 UTC 2010
Modified Files: src/sys/kern: vfs_wapbl.c Log Message: 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). To generate a diff of this commit: cvs rdiff -u -r1.30 -r1.31 src/sys/kern/vfs_wapbl.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/kern/vfs_wapbl.c diff -u src/sys/kern/vfs_wapbl.c:1.30 src/sys/kern/vfs_wapbl.c:1.31 --- src/sys/kern/vfs_wapbl.c:1.30 Sat Feb 6 12:10:59 2010 +++ src/sys/kern/vfs_wapbl.c Tue Feb 23 20:51:25 2010 @@ -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,