hc
2023-11-06 1622ff3442ff6aecc1f538cda437379d1f6a4a93
kernel/fs/buffer.c
....@@ -275,8 +275,7 @@
275275 * decide that the page is now completely done.
276276 */
277277 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);
280279 clear_buffer_async_read(bh);
281280 unlock_buffer(bh);
282281 tmp = bh;
....@@ -289,8 +288,7 @@
289288 }
290289 tmp = tmp->b_this_page;
291290 } 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);
294292
295293 /*
296294 * If none of the buffers had errors and they are all
....@@ -302,9 +300,7 @@
302300 return;
303301
304302 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);
308304 }
309305
310306 /*
....@@ -331,8 +327,7 @@
331327 }
332328
333329 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);
336331
337332 clear_buffer_async_write(bh);
338333 unlock_buffer(bh);
....@@ -344,15 +339,12 @@
344339 }
345340 tmp = tmp->b_this_page;
346341 }
347
- bit_spin_unlock(BH_Uptodate_Lock, &first->b_state);
348
- local_irq_restore(flags);
342
+ bh_uptodate_unlock_irqrestore(first, flags);
349343 end_page_writeback(page);
350344 return;
351345
352346 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);
356348 }
357349 EXPORT_SYMBOL(end_buffer_async_write);
358350
....@@ -3375,6 +3367,7 @@
33753367 struct buffer_head *ret = kmem_cache_zalloc(bh_cachep, gfp_flags);
33763368 if (ret) {
33773369 INIT_LIST_HEAD(&ret->b_assoc_buffers);
3370
+ buffer_head_init_locks(ret);
33783371 preempt_disable();
33793372 __this_cpu_inc(bh_accounting.nr);
33803373 recalc_bh_state();