btnode.c (0337966d121ebebf73a1c346123e8112796e684e) | btnode.c (b93b016313b3ba8003c3b8bb71f569af91f19fc7) |
---|---|
1/* 2 * btnode.c - NILFS B-tree node cache 3 * 4 * Copyright (C) 2005-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 --- 179 unchanged lines hidden (view full) --- 188 goto failed_unlock; 189 /* BUG_ON(oldkey != obh->b_page->index); */ 190 if (unlikely(oldkey != obh->b_page->index)) 191 NILFS_PAGE_BUG(obh->b_page, 192 "invalid oldkey %lld (newkey=%lld)", 193 (unsigned long long)oldkey, 194 (unsigned long long)newkey); 195 | 1/* 2 * btnode.c - NILFS B-tree node cache 3 * 4 * Copyright (C) 2005-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 --- 179 unchanged lines hidden (view full) --- 188 goto failed_unlock; 189 /* BUG_ON(oldkey != obh->b_page->index); */ 190 if (unlikely(oldkey != obh->b_page->index)) 191 NILFS_PAGE_BUG(obh->b_page, 192 "invalid oldkey %lld (newkey=%lld)", 193 (unsigned long long)oldkey, 194 (unsigned long long)newkey); 195 |
196 spin_lock_irq(&btnc->tree_lock); 197 err = radix_tree_insert(&btnc->page_tree, newkey, obh->b_page); 198 spin_unlock_irq(&btnc->tree_lock); | 196 xa_lock_irq(&btnc->i_pages); 197 err = radix_tree_insert(&btnc->i_pages, newkey, obh->b_page); 198 xa_unlock_irq(&btnc->i_pages); |
199 /* 200 * Note: page->index will not change to newkey until 201 * nilfs_btnode_commit_change_key() will be called. 202 * To protect the page in intermediate state, the page lock 203 * is held. 204 */ 205 radix_tree_preload_end(); 206 if (!err) --- 39 unchanged lines hidden (view full) --- 246 opage = obh->b_page; 247 if (unlikely(oldkey != opage->index)) 248 NILFS_PAGE_BUG(opage, 249 "invalid oldkey %lld (newkey=%lld)", 250 (unsigned long long)oldkey, 251 (unsigned long long)newkey); 252 mark_buffer_dirty(obh); 253 | 199 /* 200 * Note: page->index will not change to newkey until 201 * nilfs_btnode_commit_change_key() will be called. 202 * To protect the page in intermediate state, the page lock 203 * is held. 204 */ 205 radix_tree_preload_end(); 206 if (!err) --- 39 unchanged lines hidden (view full) --- 246 opage = obh->b_page; 247 if (unlikely(oldkey != opage->index)) 248 NILFS_PAGE_BUG(opage, 249 "invalid oldkey %lld (newkey=%lld)", 250 (unsigned long long)oldkey, 251 (unsigned long long)newkey); 252 mark_buffer_dirty(obh); 253 |
254 spin_lock_irq(&btnc->tree_lock); 255 radix_tree_delete(&btnc->page_tree, oldkey); 256 radix_tree_tag_set(&btnc->page_tree, newkey, | 254 xa_lock_irq(&btnc->i_pages); 255 radix_tree_delete(&btnc->i_pages, oldkey); 256 radix_tree_tag_set(&btnc->i_pages, newkey, |
257 PAGECACHE_TAG_DIRTY); | 257 PAGECACHE_TAG_DIRTY); |
258 spin_unlock_irq(&btnc->tree_lock); | 258 xa_unlock_irq(&btnc->i_pages); |
259 260 opage->index = obh->b_blocknr = newkey; 261 unlock_page(opage); 262 } else { 263 nilfs_copy_buffer(nbh, obh); 264 mark_buffer_dirty(nbh); 265 266 nbh->b_blocknr = newkey; --- 11 unchanged lines hidden (view full) --- 278{ 279 struct buffer_head *nbh = ctxt->newbh; 280 __u64 oldkey = ctxt->oldkey, newkey = ctxt->newkey; 281 282 if (oldkey == newkey) 283 return; 284 285 if (nbh == NULL) { /* blocksize == pagesize */ | 259 260 opage->index = obh->b_blocknr = newkey; 261 unlock_page(opage); 262 } else { 263 nilfs_copy_buffer(nbh, obh); 264 mark_buffer_dirty(nbh); 265 266 nbh->b_blocknr = newkey; --- 11 unchanged lines hidden (view full) --- 278{ 279 struct buffer_head *nbh = ctxt->newbh; 280 __u64 oldkey = ctxt->oldkey, newkey = ctxt->newkey; 281 282 if (oldkey == newkey) 283 return; 284 285 if (nbh == NULL) { /* blocksize == pagesize */ |
286 spin_lock_irq(&btnc->tree_lock); 287 radix_tree_delete(&btnc->page_tree, newkey); 288 spin_unlock_irq(&btnc->tree_lock); | 286 xa_lock_irq(&btnc->i_pages); 287 radix_tree_delete(&btnc->i_pages, newkey); 288 xa_unlock_irq(&btnc->i_pages); |
289 unlock_page(ctxt->bh->b_page); 290 } else 291 brelse(nbh); 292} | 289 unlock_page(ctxt->bh->b_page); 290 } else 291 brelse(nbh); 292} |