diff options
author | Chris Mason <chris.mason@oracle.com> | 2007-06-18 09:57:58 -0400 |
---|---|---|
committer | David Woodhouse <dwmw2@hera.kernel.org> | 2007-06-18 09:57:58 -0400 |
commit | 8c2383c3dd2cb5bb39598ce4fa97154bc591020a (patch) | |
tree | 68a9c491bfa19d572dca6b41e5dde7f05165c270 /fs/btrfs/inode.c | |
parent | 9ebefb180bad4914a31c4e1748ba187a30e1e990 (diff) |
Subject: Rework btrfs_file_write to only allocate while page locks are held
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/inode.c')
-rw-r--r-- | fs/btrfs/inode.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index def33ac90d77..94f1c28c25b9 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -962,7 +962,6 @@ void btrfs_dirty_inode(struct inode *inode) | |||
962 | btrfs_update_inode(trans, root, inode); | 962 | btrfs_update_inode(trans, root, inode); |
963 | btrfs_end_transaction(trans, root); | 963 | btrfs_end_transaction(trans, root); |
964 | mutex_unlock(&root->fs_info->fs_mutex); | 964 | mutex_unlock(&root->fs_info->fs_mutex); |
965 | btrfs_btree_balance_dirty(root); | ||
966 | } | 965 | } |
967 | 966 | ||
968 | static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans, | 967 | static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans, |
@@ -1402,7 +1401,6 @@ int btrfs_get_block_csum(struct inode *inode, sector_t iblock, | |||
1402 | goto out; | 1401 | goto out; |
1403 | } | 1402 | } |
1404 | memcpy((char *)&result->b_private, &item->csum, BTRFS_CRC32_SIZE); | 1403 | memcpy((char *)&result->b_private, &item->csum, BTRFS_CRC32_SIZE); |
1405 | printk("get_block_sum file %lu offset %llu csum %X\n", inode->i_ino, (unsigned long long)offset, *(int *)(&item->csum)); | ||
1406 | out: | 1404 | out: |
1407 | if (path) | 1405 | if (path) |
1408 | btrfs_free_path(path); | 1406 | btrfs_free_path(path); |
@@ -1476,7 +1474,6 @@ static void btrfs_end_buffer_async_read(struct buffer_head *bh, int uptodate) | |||
1476 | (unsigned long long)offset); | 1474 | (unsigned long long)offset); |
1477 | memset(kaddr + bh_offset(bh), 1, bh->b_size); | 1475 | memset(kaddr + bh_offset(bh), 1, bh->b_size); |
1478 | flush_dcache_page(page); | 1476 | flush_dcache_page(page); |
1479 | printk("bad verify file %lu offset %llu bh_private %lX csum %X\n", inode->i_ino, (unsigned long long)offset, (unsigned long)(bh->b_private), *(int *)csum); | ||
1480 | } | 1477 | } |
1481 | kunmap_atomic(kaddr, KM_IRQ0); | 1478 | kunmap_atomic(kaddr, KM_IRQ0); |
1482 | } | 1479 | } |
@@ -1655,6 +1652,13 @@ static int __btrfs_write_full_page(struct inode *inode, struct page *page, | |||
1655 | 1652 | ||
1656 | last_block = (i_size_read(inode) - 1) >> inode->i_blkbits; | 1653 | last_block = (i_size_read(inode) - 1) >> inode->i_blkbits; |
1657 | 1654 | ||
1655 | /* no csumming allowed when from PF_MEMALLOC */ | ||
1656 | if (current->flags & PF_MEMALLOC) { | ||
1657 | redirty_page_for_writepage(wbc, page); | ||
1658 | unlock_page(page); | ||
1659 | return 0; | ||
1660 | } | ||
1661 | |||
1658 | if (!page_has_buffers(page)) { | 1662 | if (!page_has_buffers(page)) { |
1659 | create_empty_buffers(page, blocksize, | 1663 | create_empty_buffers(page, blocksize, |
1660 | (1 << BH_Dirty)|(1 << BH_Uptodate)); | 1664 | (1 << BH_Dirty)|(1 << BH_Uptodate)); |
@@ -1885,7 +1889,6 @@ int btrfs_page_mkwrite(struct vm_area_struct *vma, struct page *page) | |||
1885 | 1889 | ||
1886 | lock_page(page); | 1890 | lock_page(page); |
1887 | wait_on_page_writeback(page); | 1891 | wait_on_page_writeback(page); |
1888 | printk("btrfs_page_mkwrite %lu %lu\n", page->mapping->host->i_ino, page->index); | ||
1889 | size = i_size_read(inode); | 1892 | size = i_size_read(inode); |
1890 | if ((page->mapping != inode->i_mapping) || | 1893 | if ((page->mapping != inode->i_mapping) || |
1891 | ((page->index << PAGE_CACHE_SHIFT) > size)) { | 1894 | ((page->index << PAGE_CACHE_SHIFT) > size)) { |