1 #include <ext2fs.h>
2 #include <linux/module.h>
3 #include <linux/errno.h>
4 
5 /*
6  * extents_bread: This function is a wrapper of CcPinRead routine.
7  *
8  * @sb:    the device we need to undergo buffered IO on.
9  * @block: the block we want to read from.
10  *
11  * If the call to this routine succeeds, the pages underlying the buffer header
12  * will be locked into memory, so that the buffer header returned for use is safe.
13  */
14 struct buffer_head *
15 extents_bread(struct super_block *sb, sector_t block)
16 {
17     return sb_getblk(sb, block);
18 }
19 
20 /*
21  * extents_bwrite: This function is a wrapper of CcPreparePinWrite routine.
22  *
23  * @sb:    the device we need to undergo buffered IO on.
24  * @block: the block we want to write to.
25  */
26 struct buffer_head *
27 extents_bwrite(struct super_block *sb, sector_t block)
28 {
29     return sb_getblk_zero(sb, block);
30 
31 }
32 
33 /*
34  * extents_mark_buffer_dirty: Mark the buffer dirtied and so
35  *                            that changes will be written back.
36  *
37  * @bh: The corresponding buffer header that is modified.
38  */
39 void extents_mark_buffer_dirty(struct buffer_head *bh)
40 {
41     set_buffer_dirty(bh);
42 }
43 
44 /*
45  * extents_brelse: Release the corresponding buffer header.
46  *
47  * @bh: The corresponding buffer header that is going to be freed.
48  *
49  * The pages underlying the buffer header will be unlocked.
50  */
51 void extents_brelse(struct buffer_head *bh)
52 {
53     brelse(bh);
54 }
55 
56 /*
57  * extents_bforget: Release the corresponding buffer header.
58  * NOTE: The page owned by @bh will be marked invalidated.
59  *
60  * @bh: The corresponding buffer header that is going to be freed.
61  *
62  * The pages underlying the buffer header will be unlocked.
63  */
64 void extents_bforget(struct buffer_head *bh)
65 {
66     clear_buffer_uptodate(bh);
67     bforget(bh);
68 }
69