aboutsummaryrefslogtreecommitdiffstats
path: root/fs/befs/io.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /fs/befs/io.c
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'fs/befs/io.c')
-rw-r--r--fs/befs/io.c83
1 files changed, 83 insertions, 0 deletions
diff --git a/fs/befs/io.c b/fs/befs/io.c
new file mode 100644
index 000000000000..ddef98aa255d
--- /dev/null
+++ b/fs/befs/io.c
@@ -0,0 +1,83 @@
1/*
2 * linux/fs/befs/io.c
3 *
4 * Copyright (C) 2001 Will Dyson <will_dyson@pobox.com
5 *
6 * Based on portions of file.c and inode.c
7 * by Makoto Kato (m_kato@ga2.so-net.ne.jp)
8 *
9 * Many thanks to Dominic Giampaolo, author of Practical File System
10 * Design with the Be File System, for such a helpful book.
11 *
12 */
13
14#include <linux/buffer_head.h>
15
16#include "befs.h"
17#include "io.h"
18
19/*
20 * Converts befs notion of disk addr to a disk offset and uses
21 * linux kernel function sb_bread() to get the buffer containing
22 * the offset. -Will Dyson
23 *
24 */
25
26struct buffer_head *
27befs_bread_iaddr(struct super_block *sb, befs_inode_addr iaddr)
28{
29 struct buffer_head *bh = NULL;
30 befs_blocknr_t block = 0;
31 befs_sb_info *befs_sb = BEFS_SB(sb);
32
33 befs_debug(sb, "---> Enter befs_read_iaddr() "
34 "[%u, %hu, %hu]",
35 iaddr.allocation_group, iaddr.start, iaddr.len);
36
37 if (iaddr.allocation_group > befs_sb->num_ags) {
38 befs_error(sb, "BEFS: Invalid allocation group %u, max is %u",
39 iaddr.allocation_group, befs_sb->num_ags);
40 goto error;
41 }
42
43 block = iaddr2blockno(sb, &iaddr);
44
45 befs_debug(sb, "befs_read_iaddr: offset = %lu", block);
46
47 bh = sb_bread(sb, block);
48
49 if (bh == NULL) {
50 befs_error(sb, "Failed to read block %lu", block);
51 goto error;
52 }
53
54 befs_debug(sb, "<--- befs_read_iaddr()");
55 return bh;
56
57 error:
58 befs_debug(sb, "<--- befs_read_iaddr() ERROR");
59 return NULL;
60}
61
62struct buffer_head *
63befs_bread(struct super_block *sb, befs_blocknr_t block)
64{
65 struct buffer_head *bh = NULL;
66
67 befs_debug(sb, "---> Enter befs_read() %Lu", block);
68
69 bh = sb_bread(sb, block);
70
71 if (bh == NULL) {
72 befs_error(sb, "Failed to read block %lu", block);
73 goto error;
74 }
75
76 befs_debug(sb, "<--- befs_read()");
77
78 return bh;
79
80 error:
81 befs_debug(sb, "<--- befs_read() ERROR");
82 return NULL;
83}