2
* Copyright (c) 2000-2001,2005 Silicon Graphics, Inc.
5
* This program is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU General Public License as
7
* published by the Free Software Foundation.
9
* This program is distributed in the hope that it would be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write the Free Software Foundation,
16
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19
#include <xfs/libxfs.h>
26
dbread(void *buf, int nblocks, xfs_fileoff_t bno, int whichfork)
39
bmap(bno, end - bno, whichfork, &nex, &bm);
44
if (bm.startoff > bno) {
45
eb = end < bm.startoff ? end : bm.startoff;
46
i = (int)XFS_FSB_TO_B(mp, eb - bno);
53
if (bno > bm.startoff) {
54
bm.blockcount -= bno - bm.startoff;
55
bm.startblock += bno - bm.startoff;
58
if (bm.startoff + bm.blockcount > end)
59
bm.blockcount = end - bm.startoff;
60
i = read_bbs(XFS_FSB_TO_DADDR(mp, bm.startblock),
61
(int)XFS_FSB_TO_BB(mp, bm.blockcount),
65
bp += XFS_FSB_TO_B(mp, bm.blockcount);