Deleted Added
full compact
ufs_bmap.c (98542) ufs_bmap.c (100344)
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.7 (Berkeley) 3/21/95
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.7 (Berkeley) 3/21/95
39 * $FreeBSD: head/sys/ufs/ufs/ufs_bmap.c 98542 2002-06-21 06:18:05Z mckusick $
39 * $FreeBSD: head/sys/ufs/ufs/ufs_bmap.c 100344 2002-07-19 07:29:39Z mckusick $
40 */
41
42#include <sys/param.h>
43#include <sys/systm.h>
44#include <sys/bio.h>
45#include <sys/buf.h>
46#include <sys/proc.h>
47#include <sys/vnode.h>

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

78 * Check for underlying vnode requests and ensure that logical
79 * to physical mapping is requested.
80 */
81 if (ap->a_vpp != NULL)
82 *ap->a_vpp = VTOI(ap->a_vp)->i_devvp;
83 if (ap->a_bnp == NULL)
84 return (0);
85
40 */
41
42#include <sys/param.h>
43#include <sys/systm.h>
44#include <sys/bio.h>
45#include <sys/buf.h>
46#include <sys/proc.h>
47#include <sys/vnode.h>

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

78 * Check for underlying vnode requests and ensure that logical
79 * to physical mapping is requested.
80 */
81 if (ap->a_vpp != NULL)
82 *ap->a_vpp = VTOI(ap->a_vp)->i_devvp;
83 if (ap->a_bnp == NULL)
84 return (0);
85
86 error = ufs_bmaparray(ap->a_vp, ap->a_bn, &blkno,
86 error = ufs_bmaparray(ap->a_vp, ap->a_bn, &blkno, NULL,
87 ap->a_runp, ap->a_runb);
88 *ap->a_bnp = blkno;
89 return (error);
90}
91
92/*
93 * Indirect blocks are now on the vnode for the file. They are given negative
94 * logical block numbers. Indirect blocks are addressed by the negative

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

99 *
100 * ufs_bmaparray does the bmap conversion, and if requested returns the
101 * array of logical blocks which must be traversed to get to a block.
102 * Each entry contains the offset into that block that gets you to the
103 * next block and the disk address of the block (if it is assigned).
104 */
105
106int
87 ap->a_runp, ap->a_runb);
88 *ap->a_bnp = blkno;
89 return (error);
90}
91
92/*
93 * Indirect blocks are now on the vnode for the file. They are given negative
94 * logical block numbers. Indirect blocks are addressed by the negative

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

99 *
100 * ufs_bmaparray does the bmap conversion, and if requested returns the
101 * array of logical blocks which must be traversed to get to a block.
102 * Each entry contains the offset into that block that gets you to the
103 * next block and the disk address of the block (if it is assigned).
104 */
105
106int
107ufs_bmaparray(vp, bn, bnp, runp, runb)
107ufs_bmaparray(vp, bn, bnp, nbp, runp, runb)
108 struct vnode *vp;
109 ufs2_daddr_t bn;
110 ufs2_daddr_t *bnp;
108 struct vnode *vp;
109 ufs2_daddr_t bn;
110 ufs2_daddr_t *bnp;
111 struct buf *nbp;
111 int *runp;
112 int *runb;
113{
114 struct inode *ip;
115 struct buf *bp;
116 struct ufsmount *ump;
117 struct mount *mp;
118 struct vnode *devvp;

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

141 ap = a;
142 nump = &num;
143 error = ufs_getlbns(vp, bn, ap, nump);
144 if (error)
145 return (error);
146
147 num = *nump;
148 if (num == 0) {
112 int *runp;
113 int *runb;
114{
115 struct inode *ip;
116 struct buf *bp;
117 struct ufsmount *ump;
118 struct mount *mp;
119 struct vnode *devvp;

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

142 ap = a;
143 nump = &num;
144 error = ufs_getlbns(vp, bn, ap, nump);
145 if (error)
146 return (error);
147
148 num = *nump;
149 if (num == 0) {
149 *bnp = blkptrtodb(ump, DIP(ip, i_db[bn]));
150 if (bn >= 0 && bn < NDADDR) {
151 *bnp = blkptrtodb(ump, DIP(ip, i_db[bn]));
152 } else if (bn < 0 && bn >= -NXADDR) {
153 *bnp = blkptrtodb(ump, ip->i_din2->di_extb[-1 - bn]);
154 if (*bnp == 0)
155 *bnp = -1;
156 if (nbp == NULL)
157 panic("ufs_bmaparray: mapping ext data");
158 nbp->b_xflags |= BX_ALTDATA;
159 return (0);
160 } else {
161 panic("ufs_bmaparray: blkno out of range");
162 }
150 /*
151 * Since this is FFS independent code, we are out of
152 * scope for the definitions of BLK_NOCOPY and
153 * BLK_SNAP, but we do know that they will fall in
154 * the range 1..um_seqinc, so we use that test and
155 * return a request for a zeroed out buffer if attempts
156 * are made to read a BLK_NOCOPY or BLK_SNAP block.
157 */

--- 212 unchanged lines hidden ---
163 /*
164 * Since this is FFS independent code, we are out of
165 * scope for the definitions of BLK_NOCOPY and
166 * BLK_SNAP, but we do know that they will fall in
167 * the range 1..um_seqinc, so we use that test and
168 * return a request for a zeroed out buffer if attempts
169 * are made to read a BLK_NOCOPY or BLK_SNAP block.
170 */

--- 212 unchanged lines hidden ---