6 * Based on portions of file.c and inode.c
9 * Many thanks to Dominic Giampaolo, author of Practical File System
10 * Design with the Be File System, for such a helpful book.
14 #include <linux/buffer_head.h>
20 * Converts befs notion of disk addr to a disk offset and uses
21 * linux kernel function sb_bread() to get the buffer containing
26 befs_bread_iaddr(struct super_block *sb, befs_inode_addr iaddr)
28 struct buffer_head *bh;
30 struct befs_sb_info *befs_sb = BEFS_SB(sb);
32 befs_debug(sb, "---> Enter %s "
33 "[%u, %hu, %hu]", __func__, iaddr.allocation_group,
34 iaddr.start, iaddr.len);
36 if (iaddr.allocation_group > befs_sb->num_ags) {
37 befs_error(sb, "BEFS: Invalid allocation group %u, max is %u",
38 iaddr.allocation_group, befs_sb->num_ags);
42 block = iaddr2blockno(sb, &iaddr);
44 befs_debug(sb, "%s: offset = %lu", __func__, (unsigned long)block);
46 bh = sb_bread(sb, block);
49 befs_error(sb, "Failed to read block %lu",
50 (unsigned long)block);
54 befs_debug(sb, "<--- %s", __func__);
58 befs_debug(sb, "<--- %s ERROR", __func__);