diff options
Diffstat (limited to 'fs/nilfs2/bmap.c')
-rw-r--r-- | fs/nilfs2/bmap.c | 53 |
1 files changed, 20 insertions, 33 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]; |