19 #define dprintf(x...) printf(x)
34 static int bfs_move_block(
unsigned long from,
unsigned long to,
37 struct buffer_head *bh, *
new;
39 bh = sb_bread(sb, from);
42 new = sb_getblk(sb, to);
43 memcpy(new->b_data, bh->b_data, bh->b_size);
51 unsigned long end,
unsigned long where)
55 dprintf(
"%08lx-%08lx->%08lx\n", start, end, where);
56 for (i = start; i <=
end; i++)
57 if(bfs_move_block(i, where + i, sb)) {
58 dprintf(
"failed to move block %08lx -> %08lx\n", i,
66 struct buffer_head *bh_result,
int create)
77 dprintf(
"c=%d, b=%08lx, phys=%09lx (granted)\n",
78 create, (
unsigned long)block, phys);
79 map_bh(bh_result, sb, phys);
88 if (bi->
i_sblock && (phys <= bi->i_eblock)) {
89 dprintf(
"c=%d, b=%08lx, phys=%08lx (interim block granted)\n",
90 create, (
unsigned long)block, phys);
91 map_bh(bh_result, sb, phys);
108 dprintf(
"c=%d, b=%08lx, phys=%08lx (simple extension)\n",
109 create, (
unsigned long)block, phys);
110 map_bh(bh_result, sb, phys);
113 mark_inode_dirty(inode);
129 dprintf(
"failed to move ino=%08lx -> fs corruption\n",
136 dprintf(
"c=%d, b=%08lx, phys=%08lx (moved)\n",
137 create, (
unsigned long)block, phys);
147 mark_inode_dirty(inode);
148 map_bh(bh_result, sb, phys);
165 loff_t
pos,
unsigned len,
unsigned flags,
166 struct page **pagep,
void **fsdata)
173 loff_t isize = mapping->
host->i_size;
174 if (pos + len > isize)
187 .readpage = bfs_readpage,
188 .writepage = bfs_writepage,
189 .write_begin = bfs_write_begin,