35 #include <linux/kernel.h>
67 vxfs_bmap_ext4(
struct inode *
ip,
long bn)
72 u32 indsize = vip->vii_ext4.ve4_indsize;
79 struct direct *
d = vip->vii_ext4.ve4_direct +
i;
80 if (bn >= 0 && bn < d->
size)
81 return (bn + d->extent);
85 if ((bn / (indsize * indsize * bsize / 4)) == 0) {
86 struct buffer_head *
buf;
90 buf = sb_bread(sb, vip->vii_ext4.ve4_indir[0]);
91 if (!buf || !buffer_mapped(buf))
94 indir = (
u32 *)buf->b_data;
95 bno = indir[(bn/indsize) % (indsize*bn)] + (bn%indsize);
105 printk(
"vxfs: indirect extent too big!\n");
128 vxfs_bmap_indir(
struct inode *ip,
long indir,
int size,
long block)
130 struct buffer_head *bp =
NULL;
138 bp = sb_bread(ip->
i_sb,
140 if (!bp || !buffer_mapped(bp))
154 pblock = vxfs_bmap_indir(ip, typ->
vt_block,
160 if ((block - off) >= typ->
vt_size)
162 pblock = (typ->
vt_block + block - off);
172 (
unsigned long long) typ4->
vd4_size,
201 vxfs_bmap_typed(
struct inode *ip,
long iblock)
218 pblock = vxfs_bmap_indir(ip, typ->
vt_block,
224 if ((iblock - off) < typ->
vt_size)
225 return (typ->
vt_block + iblock - off);
235 (
unsigned long long) typ4->
vd4_size,
265 return vxfs_bmap_ext4(ip, iblock);
267 return vxfs_bmap_typed(ip, iblock);
274 ip->
i_ino, vip->vii_orgtype);
279 ip->
i_ino, vip->vii_orgtype);