bmap.c (f198dbb9cf580c09644ebdf46846115c6daff14e) bmap.c (3033342a0b76048e32ce1faebfa85cf8f1aa93b5)
1/*
2 * bmap.c - NILFS block mapping.
3 *
4 * Copyright (C) 2006-2008 Nippon Telegraph and Telephone Corporation.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or

--- 87 unchanged lines hidden (view full) ---

96 if (bmap->b_ops->bop_check_insert != NULL) {
97 ret = bmap->b_ops->bop_check_insert(bmap, key);
98 if (ret > 0) {
99 n = bmap->b_ops->bop_gather_data(
100 bmap, keys, ptrs, NILFS_BMAP_SMALL_HIGH + 1);
101 if (n < 0)
102 return n;
103 ret = nilfs_btree_convert_and_insert(
1/*
2 * bmap.c - NILFS block mapping.
3 *
4 * Copyright (C) 2006-2008 Nippon Telegraph and Telephone Corporation.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or

--- 87 unchanged lines hidden (view full) ---

96 if (bmap->b_ops->bop_check_insert != NULL) {
97 ret = bmap->b_ops->bop_check_insert(bmap, key);
98 if (ret > 0) {
99 n = bmap->b_ops->bop_gather_data(
100 bmap, keys, ptrs, NILFS_BMAP_SMALL_HIGH + 1);
101 if (n < 0)
102 return n;
103 ret = nilfs_btree_convert_and_insert(
104 bmap, key, ptr, keys, ptrs, n,
105 NILFS_BMAP_LARGE_LOW, NILFS_BMAP_LARGE_HIGH);
104 bmap, key, ptr, keys, ptrs, n);
106 if (ret == 0)
107 bmap->b_u.u_flags |= NILFS_BMAP_LARGE;
108
109 return ret;
110 } else if (ret < 0)
111 return ret;
112 }
113

--- 39 unchanged lines hidden (view full) ---

153 if (bmap->b_ops->bop_check_delete != NULL) {
154 ret = bmap->b_ops->bop_check_delete(bmap, key);
155 if (ret > 0) {
156 n = bmap->b_ops->bop_gather_data(
157 bmap, keys, ptrs, NILFS_BMAP_LARGE_LOW + 1);
158 if (n < 0)
159 return n;
160 ret = nilfs_direct_delete_and_convert(
105 if (ret == 0)
106 bmap->b_u.u_flags |= NILFS_BMAP_LARGE;
107
108 return ret;
109 } else if (ret < 0)
110 return ret;
111 }
112

--- 39 unchanged lines hidden (view full) ---

152 if (bmap->b_ops->bop_check_delete != NULL) {
153 ret = bmap->b_ops->bop_check_delete(bmap, key);
154 if (ret > 0) {
155 n = bmap->b_ops->bop_gather_data(
156 bmap, keys, ptrs, NILFS_BMAP_LARGE_LOW + 1);
157 if (n < 0)
158 return n;
159 ret = nilfs_direct_delete_and_convert(
161 bmap, key, keys, ptrs, n,
162 NILFS_BMAP_SMALL_LOW, NILFS_BMAP_SMALL_HIGH);
160 bmap, key, keys, ptrs, n);
163 if (ret == 0)
164 bmap->b_u.u_flags &= ~NILFS_BMAP_LARGE;
165
166 return ret;
167 } else if (ret < 0)
168 return ret;
169 }
170

--- 505 unchanged lines hidden (view full) ---

676 default:
677 bmap->b_pops = &nilfs_bmap_ptr_ops_v;
678 bmap->b_last_allocated_key = 0; /* XXX: use macro */
679 bmap->b_last_allocated_ptr = NILFS_BMAP_INVALID_PTR;
680 break;
681 }
682
683 return (bmap->b_u.u_flags & NILFS_BMAP_LARGE) ?
161 if (ret == 0)
162 bmap->b_u.u_flags &= ~NILFS_BMAP_LARGE;
163
164 return ret;
165 } else if (ret < 0)
166 return ret;
167 }
168

--- 505 unchanged lines hidden (view full) ---

674 default:
675 bmap->b_pops = &nilfs_bmap_ptr_ops_v;
676 bmap->b_last_allocated_key = 0; /* XXX: use macro */
677 bmap->b_last_allocated_ptr = NILFS_BMAP_INVALID_PTR;
678 break;
679 }
680
681 return (bmap->b_u.u_flags & NILFS_BMAP_LARGE) ?
684 nilfs_btree_init(bmap,
685 NILFS_BMAP_LARGE_LOW,
686 NILFS_BMAP_LARGE_HIGH) :
687 nilfs_direct_init(bmap,
688 NILFS_BMAP_SMALL_LOW,
689 NILFS_BMAP_SMALL_HIGH);
682 nilfs_btree_init(bmap) : nilfs_direct_init(bmap);
690}
691
692/**
693 * nilfs_bmap_write - write back a bmap to an inode
694 * @bmap: bmap
695 * @raw_inode: on-disk inode
696 *
697 * Description: nilfs_bmap_write() stores @bmap in @raw_inode.

--- 39 unchanged lines hidden ---
683}
684
685/**
686 * nilfs_bmap_write - write back a bmap to an inode
687 * @bmap: bmap
688 * @raw_inode: on-disk inode
689 *
690 * Description: nilfs_bmap_write() stores @bmap in @raw_inode.

--- 39 unchanged lines hidden ---