11 #include <linux/module.h>
25 .readpage = efs_readpage,
37 dst->
cooked.ex_bn = ((
unsigned int) src->
raw[1] << 16) |
38 ((
unsigned int) src->
raw[2] << 8) |
39 ((
unsigned int) src->
raw[3] << 0);
41 dst->
cooked.ex_offset = ((
unsigned int) src->
raw[5] << 16) |
42 ((
unsigned int) src->
raw[6] << 8) |
43 ((
unsigned int) src->
raw[7] << 0);
52 struct buffer_head *bh;
65 in = INODE_INFO(inode);
79 inode_index = inode->
i_ino /
86 offset = (inode->
i_ino %
90 bh = sb_bread(inode->
i_sb, block);
93 goto read_inode_error;
96 efs_inode = (
struct efs_dinode *) (bh->b_data + offset);
116 if (rdev == 0xffff) {
118 if (sysv_major(rdev) > 0xfff)
121 device =
MKDEV(sysv_major(rdev), sysv_minor(rdev));
123 device = old_decode_dev(rdev);
132 if (i < in->numextents && in->
extents[i].
cooked.ex_magic != 0) {
135 goto read_inode_error;
153 inode->
i_data.a_ops = &efs_aops;
166 goto read_inode_error;
176 return ERR_PTR(-
EIO);
189 start = ptr->
cooked.ex_bn;
190 length = ptr->
cooked.ex_length;
191 offset = ptr->
cooked.ex_offset;
193 if ((block >= offset) && (block < offset+length)) {
194 return(sb->
fs_start + start + block - offset);
203 struct buffer_head *bh =
NULL;
206 int ibase, ioffset, dirext, direxts, indext, indexts;
214 if ((result = efs_extent_check(&in->
extents[last], block, sb)))
229 for(dirext = 1; dirext < direxts; dirext++) {
231 if ((result = efs_extent_check(&in->
extents[cur], block, sb))) {
237 printk(
KERN_ERR "EFS: map_block() failed to map block %u (dir)\n", block);
242 printk(
KERN_DEBUG "EFS: map_block(): indirect search for logical block %u\n", block);
247 for(indext = 0; indext < indexts; indext++) {
248 cur = (last + indext) % indexts;
258 for(dirext = 0; cur < ibase && dirext < direxts; dirext++) {
263 if (dirext == direxts) {
265 printk(
KERN_ERR "EFS: couldn't find direct extent for indirect extent %d (block %u)\n", cur, block);
274 ioffset = (cur -
ibase) %
277 if (first || lastblock != iblock) {
280 bh = sb_bread(inode->
i_sb, iblock);
286 printk(
KERN_DEBUG "EFS: map_block(): read indirect extent block %d\n", iblock);
294 extent_copy(&(exts[ioffset]), &
ext);
296 if (ext.
cooked.ex_magic != 0) {
297 printk(
KERN_ERR "EFS: extent %d has bad magic number in block %d\n", cur, iblock);
302 if ((result = efs_extent_check(&ext, block, sb))) {
309 printk(
KERN_ERR "EFS: map_block() failed to map block %u (indir)\n", block);