Use accessors for some more indirect block manipulations.

This commit is contained in:
dholland 2015-10-10 22:33:31 +00:00
parent d921302e7e
commit 5cc5e3bd23
2 changed files with 15 additions and 19 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: lfs_balloc.c,v 1.87 2015/09/01 06:08:37 dholland Exp $ */
/* $NetBSD: lfs_balloc.c,v 1.88 2015/10/10 22:33:31 dholland Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@ -60,7 +60,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: lfs_balloc.c,v 1.87 2015/09/01 06:08:37 dholland Exp $");
__KERNEL_RCSID(0, "$NetBSD: lfs_balloc.c,v 1.88 2015/10/10 22:33:31 dholland Exp $");
#if defined(_KERNEL_OPT)
#include "opt_quota.h"
@ -271,12 +271,10 @@ lfs_balloc(struct vnode *vp, off_t startoffset, int iosize, kauth_cred_t cred,
* If that is the case mark it UNWRITTEN to keep
* the accounting straight.
*/
/* XXX ondisk32 */
if (((int32_t *)ibp->b_data)[indirs[i].in_off] == 0)
((int32_t *)ibp->b_data)[indirs[i].in_off] =
UNWRITTEN;
/* XXX ondisk32 */
idaddr = ((int32_t *)ibp->b_data)[indirs[i].in_off];
if (lfs_iblock_get(fs, ibp->b_data, indirs[i].in_off) == 0)
lfs_iblock_set(fs, ibp->b_data, indirs[i].in_off,
UNWRITTEN);
idaddr = lfs_iblock_get(fs, ibp->b_data, indirs[i].in_off);
#ifdef DEBUG
if (vp == fs->lfs_ivnode) {
LFS_ENTER_LOG("balloc", __FILE__,
@ -333,8 +331,7 @@ lfs_balloc(struct vnode *vp, off_t startoffset, int iosize, kauth_cred_t cred,
B_MODIFY, &ibp))
panic("lfs_balloc: bread bno %lld",
(long long)idp->in_lbn);
/* XXX ondisk32 */
((int32_t *)ibp->b_data)[idp->in_off] = UNWRITTEN;
lfs_iblock_set(fs, ibp->b_data, idp->in_off, UNWRITTEN);
#ifdef DEBUG
if (vp == fs->lfs_ivnode) {
LFS_ENTER_LOG("balloc", __FILE__,

View File

@ -1,4 +1,4 @@
/* $NetBSD: lfs_segment.c,v 1.260 2015/10/03 08:28:16 dholland Exp $ */
/* $NetBSD: lfs_segment.c,v 1.261 2015/10/10 22:33:31 dholland Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@ -60,7 +60,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: lfs_segment.c,v 1.260 2015/10/03 08:28:16 dholland Exp $");
__KERNEL_RCSID(0, "$NetBSD: lfs_segment.c,v 1.261 2015/10/10 22:33:31 dholland Exp $");
#ifdef DEBUG
# define vndebug(vp, str) do { \
@ -2035,7 +2035,7 @@ lfs_writeseg(struct lfs *fs, struct segment *sp)
struct vnode *devvp;
char *p = NULL;
struct vnode *vp;
int32_t *daddrp; /* XXX ondisk32 */
unsigned ibindex, iblimit;
int changed;
u_int32_t sum;
size_t sumstart;
@ -2162,13 +2162,12 @@ lfs_writeseg(struct lfs *fs, struct segment *sp)
newbp->b_bcount);
changed = 0;
/* XXX ondisk32 */
for (daddrp = (int32_t *)(newbp->b_data);
daddrp < (int32_t *)((char *)newbp->b_data +
newbp->b_bcount); daddrp++) {
if (*daddrp == UNWRITTEN) {
iblimit = newbp->b_bcount / LFS_BLKPTRSIZE(fs);
for (ibindex = 0; ibindex < iblimit; ibindex++) {
if (lfs_iblock_get(fs, newbp->b_data, ibindex) == UNWRITTEN) {
++changed;
*daddrp = 0;
lfs_iblock_set(fs, newbp->b_data,
ibindex, 0);
}
}
/*