| .. | .. |
|---|
| 275 | 275 | * decide that the page is now completely done. |
|---|
| 276 | 276 | */ |
|---|
| 277 | 277 | first = page_buffers(page); |
|---|
| 278 | | - local_irq_save(flags); |
|---|
| 279 | | - bit_spin_lock(BH_Uptodate_Lock, &first->b_state); |
|---|
| 278 | + flags = bh_uptodate_lock_irqsave(first); |
|---|
| 280 | 279 | clear_buffer_async_read(bh); |
|---|
| 281 | 280 | unlock_buffer(bh); |
|---|
| 282 | 281 | tmp = bh; |
|---|
| .. | .. |
|---|
| 289 | 288 | } |
|---|
| 290 | 289 | tmp = tmp->b_this_page; |
|---|
| 291 | 290 | } while (tmp != bh); |
|---|
| 292 | | - bit_spin_unlock(BH_Uptodate_Lock, &first->b_state); |
|---|
| 293 | | - local_irq_restore(flags); |
|---|
| 291 | + bh_uptodate_unlock_irqrestore(first, flags); |
|---|
| 294 | 292 | |
|---|
| 295 | 293 | /* |
|---|
| 296 | 294 | * If none of the buffers had errors and they are all |
|---|
| .. | .. |
|---|
| 302 | 300 | return; |
|---|
| 303 | 301 | |
|---|
| 304 | 302 | still_busy: |
|---|
| 305 | | - bit_spin_unlock(BH_Uptodate_Lock, &first->b_state); |
|---|
| 306 | | - local_irq_restore(flags); |
|---|
| 307 | | - return; |
|---|
| 303 | + bh_uptodate_unlock_irqrestore(first, flags); |
|---|
| 308 | 304 | } |
|---|
| 309 | 305 | |
|---|
| 310 | 306 | /* |
|---|
| .. | .. |
|---|
| 331 | 327 | } |
|---|
| 332 | 328 | |
|---|
| 333 | 329 | first = page_buffers(page); |
|---|
| 334 | | - local_irq_save(flags); |
|---|
| 335 | | - bit_spin_lock(BH_Uptodate_Lock, &first->b_state); |
|---|
| 330 | + flags = bh_uptodate_lock_irqsave(first); |
|---|
| 336 | 331 | |
|---|
| 337 | 332 | clear_buffer_async_write(bh); |
|---|
| 338 | 333 | unlock_buffer(bh); |
|---|
| .. | .. |
|---|
| 344 | 339 | } |
|---|
| 345 | 340 | tmp = tmp->b_this_page; |
|---|
| 346 | 341 | } |
|---|
| 347 | | - bit_spin_unlock(BH_Uptodate_Lock, &first->b_state); |
|---|
| 348 | | - local_irq_restore(flags); |
|---|
| 342 | + bh_uptodate_unlock_irqrestore(first, flags); |
|---|
| 349 | 343 | end_page_writeback(page); |
|---|
| 350 | 344 | return; |
|---|
| 351 | 345 | |
|---|
| 352 | 346 | still_busy: |
|---|
| 353 | | - bit_spin_unlock(BH_Uptodate_Lock, &first->b_state); |
|---|
| 354 | | - local_irq_restore(flags); |
|---|
| 355 | | - return; |
|---|
| 347 | + bh_uptodate_unlock_irqrestore(first, flags); |
|---|
| 356 | 348 | } |
|---|
| 357 | 349 | EXPORT_SYMBOL(end_buffer_async_write); |
|---|
| 358 | 350 | |
|---|
| .. | .. |
|---|
| 3375 | 3367 | struct buffer_head *ret = kmem_cache_zalloc(bh_cachep, gfp_flags); |
|---|
| 3376 | 3368 | if (ret) { |
|---|
| 3377 | 3369 | INIT_LIST_HEAD(&ret->b_assoc_buffers); |
|---|
| 3370 | + buffer_head_init_locks(ret); |
|---|
| 3378 | 3371 | preempt_disable(); |
|---|
| 3379 | 3372 | __this_cpu_inc(bh_accounting.nr); |
|---|
| 3380 | 3373 | recalc_bh_state(); |
|---|