24 #include <linux/string.h>
25 #include <linux/errno.h>
49 "broken bmap (inode number=%lu)\n", inode->
i_ino);
82 ret = bmap->
b_ops->bop_lookup(bmap, key, level, ptrp);
84 ret = nilfs_bmap_convert_error(bmap, __func__, ret);
105 ret = bmap->
b_ops->bop_lookup_contig(bmap, key, ptrp, maxblocks);
108 return nilfs_bmap_convert_error(bmap, __func__, ret);
117 if (bmap->
b_ops->bop_check_insert !=
NULL) {
118 ret = bmap->
b_ops->bop_check_insert(bmap, key);
120 n = bmap->
b_ops->bop_gather_data(
125 bmap, key, ptr, keys, ptrs, n);
134 return bmap->
b_ops->bop_insert(bmap, key, ptr);
162 ret = nilfs_bmap_do_insert(bmap, key, rec);
165 return nilfs_bmap_convert_error(bmap, __func__, ret);
174 if (bmap->
b_ops->bop_check_delete !=
NULL) {
175 ret = bmap->
b_ops->bop_check_delete(bmap, key);
177 n = bmap->
b_ops->bop_gather_data(
182 bmap, key, keys, ptrs, n);
191 return bmap->
b_ops->bop_delete(bmap, key);
200 ret = bmap->
b_ops->bop_last_key(bmap, &lastkey);
204 ret = nilfs_bmap_convert_error(bmap, __func__, ret);
232 ret = nilfs_bmap_do_delete(bmap, key);
235 return nilfs_bmap_convert_error(bmap, __func__, ret);
238 static int nilfs_bmap_do_truncate(
struct nilfs_bmap *bmap,
unsigned long key)
243 ret = bmap->
b_ops->bop_last_key(bmap, &lastkey);
250 while (key <= lastkey) {
251 ret = nilfs_bmap_do_delete(bmap, lastkey);
254 ret = bmap->
b_ops->bop_last_key(bmap, &lastkey);
284 ret = nilfs_bmap_do_truncate(bmap, key);
287 return nilfs_bmap_convert_error(bmap, __func__, ret);
300 bmap->
b_ops->bop_clear(bmap);
324 ret = bmap->
b_ops->bop_propagate(bmap, bh);
327 return nilfs_bmap_convert_error(bmap, __func__, ret);
338 if (bmap->
b_ops->bop_lookup_dirty_buffers !=
NULL)
339 bmap->
b_ops->bop_lookup_dirty_buffers(bmap, listp);
362 struct buffer_head **bh,
369 ret = bmap->
b_ops->bop_assign(bmap, bh, blocknr, binfo);
372 return nilfs_bmap_convert_error(bmap, __func__, ret);
399 ret = bmap->
b_ops->bop_mark(bmap, key, level);
402 return nilfs_bmap_convert_error(bmap, __func__, ret);
419 ret = nilfs_bmap_dirty(bmap);
420 nilfs_bmap_clear_dirty(bmap);
430 const struct buffer_head *bh)
432 struct buffer_head *pbh;
437 for (pbh = page_buffers(bh->b_page); pbh != bh; pbh = pbh->b_this_page)
456 #define NILFS_BMAP_GROUP_DIV 8
460 unsigned long entries_per_group = nilfs_palloc_entries_per_group(dat);
461 unsigned long group = bmap->
b_inode->i_ino / entries_per_group;
463 return group * entries_per_group +
485 if (raw_inode ==
NULL)
492 bmap->
b_inode = &NILFS_BMAP_I(bmap)->vfs_inode;
493 switch (bmap->
b_inode->i_ino) {
543 bmap->
b_inode = &NILFS_BMAP_I(bmap)->vfs_inode;