diff options
Diffstat (limited to 'fs/nilfs2')
-rw-r--r-- | fs/nilfs2/bmap.c | 53 | ||||
-rw-r--r-- | fs/nilfs2/bmap.h | 7 | ||||
-rw-r--r-- | fs/nilfs2/mdt.c | 4 |
3 files changed, 28 insertions, 36 deletions
diff --git a/fs/nilfs2/bmap.c b/fs/nilfs2/bmap.c index f98c5c4cf6e7..08834df6ec68 100644 --- a/fs/nilfs2/bmap.c +++ b/fs/nilfs2/bmap.c | |||
@@ -36,6 +36,26 @@ struct inode *nilfs_bmap_get_dat(const struct nilfs_bmap *bmap) | |||
36 | return nilfs_dat_inode(NILFS_I_NILFS(bmap->b_inode)); | 36 | return nilfs_dat_inode(NILFS_I_NILFS(bmap->b_inode)); |
37 | } | 37 | } |
38 | 38 | ||
39 | /** | ||
40 | * nilfs_bmap_lookup_at_level - find a data block or node block | ||
41 | * @bmap: bmap | ||
42 | * @key: key | ||
43 | * @level: level | ||
44 | * @ptrp: place to store the value associated to @key | ||
45 | * | ||
46 | * Description: nilfs_bmap_lookup_at_level() finds a record whose key | ||
47 | * matches @key in the block at @level of the bmap. | ||
48 | * | ||
49 | * Return Value: On success, 0 is returned and the record associated with @key | ||
50 | * is stored in the place pointed by @ptrp. On error, one of the following | ||
51 | * negative error codes is returned. | ||
52 | * | ||
53 | * %-EIO - I/O error. | ||
54 | * | ||
55 | * %-ENOMEM - Insufficient amount of memory available. | ||
56 | * | ||
57 | * %-ENOENT - A record associated with @key does not exist. | ||
58 | */ | ||
39 | int nilfs_bmap_lookup_at_level(struct nilfs_bmap *bmap, __u64 key, int level, | 59 | int nilfs_bmap_lookup_at_level(struct nilfs_bmap *bmap, __u64 key, int level, |
40 | __u64 *ptrp) | 60 | __u64 *ptrp) |
41 | { | 61 | { |
@@ -69,39 +89,6 @@ int nilfs_bmap_lookup_contig(struct nilfs_bmap *bmap, __u64 key, __u64 *ptrp, | |||
69 | return ret; | 89 | return ret; |
70 | } | 90 | } |
71 | 91 | ||
72 | /** | ||
73 | * nilfs_bmap_lookup - find a record | ||
74 | * @bmap: bmap | ||
75 | * @key: key | ||
76 | * @recp: pointer to record | ||
77 | * | ||
78 | * Description: nilfs_bmap_lookup() finds a record whose key matches @key in | ||
79 | * @bmap. | ||
80 | * | ||
81 | * Return Value: On success, 0 is returned and the record associated with @key | ||
82 | * is stored in the place pointed by @recp. On error, one of the following | ||
83 | * negative error codes is returned. | ||
84 | * | ||
85 | * %-EIO - I/O error. | ||
86 | * | ||
87 | * %-ENOMEM - Insufficient amount of memory available. | ||
88 | * | ||
89 | * %-ENOENT - A record associated with @key does not exist. | ||
90 | */ | ||
91 | int nilfs_bmap_lookup(struct nilfs_bmap *bmap, | ||
92 | unsigned long key, | ||
93 | unsigned long *recp) | ||
94 | { | ||
95 | __u64 ptr; | ||
96 | int ret; | ||
97 | |||
98 | /* XXX: use macro for level 1 */ | ||
99 | ret = nilfs_bmap_lookup_at_level(bmap, key, 1, &ptr); | ||
100 | if (recp != NULL) | ||
101 | *recp = ptr; | ||
102 | return ret; | ||
103 | } | ||
104 | |||
105 | static int nilfs_bmap_do_insert(struct nilfs_bmap *bmap, __u64 key, __u64 ptr) | 92 | static int nilfs_bmap_do_insert(struct nilfs_bmap *bmap, __u64 key, __u64 ptr) |
106 | { | 93 | { |
107 | __u64 keys[NILFS_BMAP_SMALL_HIGH + 1]; | 94 | __u64 keys[NILFS_BMAP_SMALL_HIGH + 1]; |
diff --git a/fs/nilfs2/bmap.h b/fs/nilfs2/bmap.h index a4f64e54424c..9980d7dbab91 100644 --- a/fs/nilfs2/bmap.h +++ b/fs/nilfs2/bmap.h | |||
@@ -142,7 +142,6 @@ struct nilfs_bmap { | |||
142 | int nilfs_bmap_test_and_clear_dirty(struct nilfs_bmap *); | 142 | int nilfs_bmap_test_and_clear_dirty(struct nilfs_bmap *); |
143 | int nilfs_bmap_read(struct nilfs_bmap *, struct nilfs_inode *); | 143 | int nilfs_bmap_read(struct nilfs_bmap *, struct nilfs_inode *); |
144 | void nilfs_bmap_write(struct nilfs_bmap *, struct nilfs_inode *); | 144 | void nilfs_bmap_write(struct nilfs_bmap *, struct nilfs_inode *); |
145 | int nilfs_bmap_lookup(struct nilfs_bmap *, unsigned long, unsigned long *); | ||
146 | int nilfs_bmap_lookup_contig(struct nilfs_bmap *, __u64, __u64 *, unsigned); | 145 | int nilfs_bmap_lookup_contig(struct nilfs_bmap *, __u64, __u64 *, unsigned); |
147 | int nilfs_bmap_insert(struct nilfs_bmap *, unsigned long, unsigned long); | 146 | int nilfs_bmap_insert(struct nilfs_bmap *, unsigned long, unsigned long); |
148 | int nilfs_bmap_delete(struct nilfs_bmap *, unsigned long); | 147 | int nilfs_bmap_delete(struct nilfs_bmap *, unsigned long); |
@@ -161,6 +160,12 @@ void nilfs_bmap_init_gcdat(struct nilfs_bmap *, struct nilfs_bmap *); | |||
161 | void nilfs_bmap_commit_gcdat(struct nilfs_bmap *, struct nilfs_bmap *); | 160 | void nilfs_bmap_commit_gcdat(struct nilfs_bmap *, struct nilfs_bmap *); |
162 | 161 | ||
163 | 162 | ||
163 | static inline int nilfs_bmap_lookup(struct nilfs_bmap *bmap, __u64 key, | ||
164 | __u64 *ptr) | ||
165 | { | ||
166 | return nilfs_bmap_lookup_at_level(bmap, key, 1, ptr); | ||
167 | } | ||
168 | |||
164 | /* | 169 | /* |
165 | * Internal use only | 170 | * Internal use only |
166 | */ | 171 | */ |
diff --git a/fs/nilfs2/mdt.c b/fs/nilfs2/mdt.c index 9cb831899119..156bf6091a96 100644 --- a/fs/nilfs2/mdt.c +++ b/fs/nilfs2/mdt.c | |||
@@ -136,7 +136,7 @@ nilfs_mdt_submit_block(struct inode *inode, unsigned long blkoff, | |||
136 | int mode, struct buffer_head **out_bh) | 136 | int mode, struct buffer_head **out_bh) |
137 | { | 137 | { |
138 | struct buffer_head *bh; | 138 | struct buffer_head *bh; |
139 | unsigned long blknum = 0; | 139 | __u64 blknum = 0; |
140 | int ret = -ENOMEM; | 140 | int ret = -ENOMEM; |
141 | 141 | ||
142 | bh = nilfs_grab_buffer(inode, inode->i_mapping, blkoff, 0); | 142 | bh = nilfs_grab_buffer(inode, inode->i_mapping, blkoff, 0); |
@@ -166,7 +166,7 @@ nilfs_mdt_submit_block(struct inode *inode, unsigned long blkoff, | |||
166 | goto failed_bh; | 166 | goto failed_bh; |
167 | } | 167 | } |
168 | bh->b_bdev = NILFS_MDT(inode)->mi_nilfs->ns_bdev; | 168 | bh->b_bdev = NILFS_MDT(inode)->mi_nilfs->ns_bdev; |
169 | bh->b_blocknr = blknum; | 169 | bh->b_blocknr = (sector_t)blknum; |
170 | set_buffer_mapped(bh); | 170 | set_buffer_mapped(bh); |
171 | 171 | ||
172 | bh->b_end_io = end_buffer_read_sync; | 172 | bh->b_end_io = end_buffer_read_sync; |