Deleted Added
full compact
ext2_bmap.c (3427) ext2_bmap.c (5455)
1/*
2 * Copyright (c) 1989, 1991, 1993
3 * The Regents of the University of California. All rights reserved.
4 * (c) UNIX System Laboratories, Inc.
5 * All or some portions of this file are derived from material licensed
6 * to the University of California by American Telephone and Telegraph
7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
8 * the permission of UNIX System Laboratories, Inc.

--- 22 unchanged lines hidden (view full) ---

31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 * SUCH DAMAGE.
37 *
38 * @(#)ufs_bmap.c 8.6 (Berkeley) 1/21/94
1/*
2 * Copyright (c) 1989, 1991, 1993
3 * The Regents of the University of California. All rights reserved.
4 * (c) UNIX System Laboratories, Inc.
5 * All or some portions of this file are derived from material licensed
6 * to the University of California by American Telephone and Telegraph
7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
8 * the permission of UNIX System Laboratories, Inc.

--- 22 unchanged lines hidden (view full) ---

31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 * SUCH DAMAGE.
37 *
38 * @(#)ufs_bmap.c 8.6 (Berkeley) 1/21/94
39 * $Id: ufs_bmap.c,v 1.3 1994/08/02 07:54:52 davidg Exp $
39 * $Id: ufs_bmap.c,v 1.4 1994/10/08 06:57:21 phk Exp $
40 */
41
42#include <sys/param.h>
43#include <sys/buf.h>
44#include <sys/proc.h>
45#include <sys/vnode.h>
46#include <sys/mount.h>
47#include <sys/resourcevar.h>

--- 75 unchanged lines hidden (view full) ---

123#ifdef DIAGNOSTIC
124 if (ap != NULL && nump == NULL || ap == NULL && nump != NULL)
125 panic("ufs_bmaparray: invalid arguments");
126#endif
127
128 if (runp) {
129 /*
130 * XXX
40 */
41
42#include <sys/param.h>
43#include <sys/buf.h>
44#include <sys/proc.h>
45#include <sys/vnode.h>
46#include <sys/mount.h>
47#include <sys/resourcevar.h>

--- 75 unchanged lines hidden (view full) ---

123#ifdef DIAGNOSTIC
124 if (ap != NULL && nump == NULL || ap == NULL && nump != NULL)
125 panic("ufs_bmaparray: invalid arguments");
126#endif
127
128 if (runp) {
129 /*
130 * XXX
131 * If MAXBSIZE is the largest transfer the disks can handle,
131 * If MAXPHYS is the largest transfer the disks can handle,
132 * we probably want maxrun to be 1 block less so that we
133 * don't create a block larger than the device can handle.
134 */
135 *runp = 0;
132 * we probably want maxrun to be 1 block less so that we
133 * don't create a block larger than the device can handle.
134 */
135 *runp = 0;
136 maxrun = MAXBSIZE / mp->mnt_stat.f_iosize - 1;
136 maxrun = MAXPHYS / mp->mnt_stat.f_iosize - 1;
137 }
138
139 xap = ap == NULL ? a : ap;
140 if (!nump)
141 nump = &num;
142 error = ufs_getlbns(vp, bn, xap, nump);
143 if (error)
144 return (error);

--- 29 unchanged lines hidden (view full) ---

174 * If we get here, we've either got the block in the cache
175 * or we have a disk address for it, go fetch it.
176 */
177 if (bp)
178 brelse(bp);
179
180 xap->in_exists = 1;
181 bp = getblk(vp, metalbn, mp->mnt_stat.f_iosize, 0, 0);
137 }
138
139 xap = ap == NULL ? a : ap;
140 if (!nump)
141 nump = &num;
142 error = ufs_getlbns(vp, bn, xap, nump);
143 if (error)
144 return (error);

--- 29 unchanged lines hidden (view full) ---

174 * If we get here, we've either got the block in the cache
175 * or we have a disk address for it, go fetch it.
176 */
177 if (bp)
178 brelse(bp);
179
180 xap->in_exists = 1;
181 bp = getblk(vp, metalbn, mp->mnt_stat.f_iosize, 0, 0);
182 if (bp->b_flags & (B_DONE | B_DELWRI)) {
182 if (bp->b_flags & B_CACHE) {
183 trace(TR_BREADHIT, pack(vp, size), metalbn);
184 }
185#ifdef DIAGNOSTIC
186 else if (!daddr)
187 panic("ufs_bmaparry: indirect block not in cache");
188#endif
189 else {
190 trace(TR_BREADMISS, pack(vp, size), metalbn);
191 bp->b_blkno = blkptrtodb(ump, daddr);
192 bp->b_flags |= B_READ;
183 trace(TR_BREADHIT, pack(vp, size), metalbn);
184 }
185#ifdef DIAGNOSTIC
186 else if (!daddr)
187 panic("ufs_bmaparry: indirect block not in cache");
188#endif
189 else {
190 trace(TR_BREADMISS, pack(vp, size), metalbn);
191 bp->b_blkno = blkptrtodb(ump, daddr);
192 bp->b_flags |= B_READ;
193 vfs_busy_pages(bp, 0);
193 VOP_STRATEGY(bp);
194 curproc->p_stats->p_ru.ru_inblock++; /* XXX */
195 error = biowait(bp);
196 if (error) {
197 brelse(bp);
198 return (error);
199 }
200 }

--- 99 unchanged lines hidden ---
194 VOP_STRATEGY(bp);
195 curproc->p_stats->p_ru.ru_inblock++; /* XXX */
196 error = biowait(bp);
197 if (error) {
198 brelse(bp);
199 return (error);
200 }
201 }

--- 99 unchanged lines hidden ---