buffer.c (7eaceaccab5f40bbfda044629a6298616aeaed50) buffer.c (721a9602e6607417c6bc15b18e97a2f35266c690)
1/*
2 * linux/fs/buffer.c
3 *
4 * Copyright (C) 1991, 1992, 2002 Linus Torvalds
5 */
6
7/*
8 * Start bdflush() with kernel_thread not syscall - Paul Gortmaker, 12/95

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

762 spin_unlock(lock);
763 /*
764 * Ensure any pending I/O completes so that
765 * write_dirty_buffer() actually writes the
766 * current contents - it is a noop if I/O is
767 * still in flight on potentially older
768 * contents.
769 */
1/*
2 * linux/fs/buffer.c
3 *
4 * Copyright (C) 1991, 1992, 2002 Linus Torvalds
5 */
6
7/*
8 * Start bdflush() with kernel_thread not syscall - Paul Gortmaker, 12/95

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

762 spin_unlock(lock);
763 /*
764 * Ensure any pending I/O completes so that
765 * write_dirty_buffer() actually writes the
766 * current contents - it is a noop if I/O is
767 * still in flight on potentially older
768 * contents.
769 */
770 write_dirty_buffer(bh, WRITE_SYNC_PLUG);
770 write_dirty_buffer(bh, WRITE_SYNC);
771
772 /*
773 * Kick off IO for the previous mapping. Note
774 * that we will not run the very last mapping,
775 * wait_on_buffer() will do that for us
776 * through sync_buffer().
777 */
778 brelse(bh);

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

1597 *
1598 * If block_write_full_page() is called for regular writeback
1599 * (wbc->sync_mode == WB_SYNC_NONE) then it will redirty a page which has a
1600 * locked buffer. This only can happen if someone has written the buffer
1601 * directly, with submit_bh(). At the address_space level PageWriteback
1602 * prevents this contention from occurring.
1603 *
1604 * If block_write_full_page() is called with wbc->sync_mode ==
771
772 /*
773 * Kick off IO for the previous mapping. Note
774 * that we will not run the very last mapping,
775 * wait_on_buffer() will do that for us
776 * through sync_buffer().
777 */
778 brelse(bh);

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

1597 *
1598 * If block_write_full_page() is called for regular writeback
1599 * (wbc->sync_mode == WB_SYNC_NONE) then it will redirty a page which has a
1600 * locked buffer. This only can happen if someone has written the buffer
1601 * directly, with submit_bh(). At the address_space level PageWriteback
1602 * prevents this contention from occurring.
1603 *
1604 * If block_write_full_page() is called with wbc->sync_mode ==
1605 * WB_SYNC_ALL, the writes are posted using WRITE_SYNC_PLUG; this
1606 * causes the writes to be flagged as synchronous writes, but the
1607 * block device queue will NOT be unplugged, since usually many pages
1608 * will be pushed to the out before the higher-level caller actually
1609 * waits for the writes to be completed. The various wait functions,
1610 * such as wait_on_writeback_range() will ultimately call sync_page()
1611 * which will ultimately call blk_run_backing_dev(), which will end up
1612 * unplugging the device queue.
1605 * WB_SYNC_ALL, the writes are posted using WRITE_SYNC; this
1606 * causes the writes to be flagged as synchronous writes.
1613 */
1614static int __block_write_full_page(struct inode *inode, struct page *page,
1615 get_block_t *get_block, struct writeback_control *wbc,
1616 bh_end_io_t *handler)
1617{
1618 int err;
1619 sector_t block;
1620 sector_t last_block;
1621 struct buffer_head *bh, *head;
1622 const unsigned blocksize = 1 << inode->i_blkbits;
1623 int nr_underway = 0;
1624 int write_op = (wbc->sync_mode == WB_SYNC_ALL ?
1607 */
1608static int __block_write_full_page(struct inode *inode, struct page *page,
1609 get_block_t *get_block, struct writeback_control *wbc,
1610 bh_end_io_t *handler)
1611{
1612 int err;
1613 sector_t block;
1614 sector_t last_block;
1615 struct buffer_head *bh, *head;
1616 const unsigned blocksize = 1 << inode->i_blkbits;
1617 int nr_underway = 0;
1618 int write_op = (wbc->sync_mode == WB_SYNC_ALL ?
1625 WRITE_SYNC_PLUG : WRITE);
1619 WRITE_SYNC : WRITE);
1626
1627 BUG_ON(!PageLocked(page));
1628
1629 last_block = (i_size_read(inode) - 1) >> inode->i_blkbits;
1630
1631 if (!page_has_buffers(page)) {
1632 create_empty_buffers(page, blocksize,
1633 (1 << BH_Dirty)|(1 << BH_Uptodate));

--- 1662 unchanged lines hidden ---
1620
1621 BUG_ON(!PageLocked(page));
1622
1623 last_block = (i_size_read(inode) - 1) >> inode->i_blkbits;
1624
1625 if (!page_has_buffers(page)) {
1626 create_empty_buffers(page, blocksize,
1627 (1 << BH_Dirty)|(1 << BH_Uptodate));

--- 1662 unchanged lines hidden ---