]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs...
authorChris Mason <chris.mason@oracle.com>
Thu, 1 Oct 2009 21:24:44 +0000 (17:24 -0400)
committerChris Mason <chris.mason@oracle.com>
Thu, 1 Oct 2009 21:24:44 +0000 (17:24 -0400)
1  2 
fs/btrfs/inode.c

diff --combined fs/btrfs/inode.c
index 5b9c8e0d6dd66dd7da7e18d1b6bbfcab6c291222,3a6f953337b51eb7068ae7e0f1489a582b9b054e..f4001112df78ee490c526d8840483ecc45167139
@@@ -55,13 -55,13 +55,13 @@@ struct btrfs_iget_args 
        struct btrfs_root *root;
  };
  
 -static struct inode_operations btrfs_dir_inode_operations;
 -static struct inode_operations btrfs_symlink_inode_operations;
 -static struct inode_operations btrfs_dir_ro_inode_operations;
 -static struct inode_operations btrfs_special_inode_operations;
 -static struct inode_operations btrfs_file_inode_operations;
 -static struct address_space_operations btrfs_aops;
 -static struct address_space_operations btrfs_symlink_aops;
 +static const struct inode_operations btrfs_dir_inode_operations;
 +static const struct inode_operations btrfs_symlink_inode_operations;
 +static const struct inode_operations btrfs_dir_ro_inode_operations;
 +static const struct inode_operations btrfs_special_inode_operations;
 +static const struct inode_operations btrfs_file_inode_operations;
 +static const struct address_space_operations btrfs_aops;
 +static const struct address_space_operations btrfs_symlink_aops;
  static struct file_operations btrfs_dir_file_operations;
  static struct extent_io_ops btrfs_extent_io_ops;
  
@@@ -4909,10 -4909,21 +4909,21 @@@ again
                goto again;
        }
  
+       /*
+        * XXX - page_mkwrite gets called every time the page is dirtied, even
+        * if it was already dirty, so for space accounting reasons we need to
+        * clear any delalloc bits for the range we are fixing to save.  There
+        * is probably a better way to do this, but for now keep consistent with
+        * prepare_pages in the normal write path.
+        */
+       clear_extent_bits(&BTRFS_I(inode)->io_tree, page_start, page_end,
+                         EXTENT_DIRTY | EXTENT_DELALLOC, GFP_NOFS);
        ret = btrfs_set_extent_delalloc(inode, page_start, page_end);
        if (ret) {
                unlock_extent(io_tree, page_start, page_end, GFP_NOFS);
                ret = VM_FAULT_SIGBUS;
+               btrfs_free_reserved_data_space(root, inode, PAGE_CACHE_SIZE);
                goto out_unlock;
        }
        ret = 0;
@@@ -5681,7 -5692,7 +5692,7 @@@ static int btrfs_permission(struct inod
        return generic_permission(inode, mask, btrfs_check_acl);
  }
  
 -static struct inode_operations btrfs_dir_inode_operations = {
 +static const struct inode_operations btrfs_dir_inode_operations = {
        .getattr        = btrfs_getattr,
        .lookup         = btrfs_lookup,
        .create         = btrfs_create,
        .removexattr    = btrfs_removexattr,
        .permission     = btrfs_permission,
  };
 -static struct inode_operations btrfs_dir_ro_inode_operations = {
 +static const struct inode_operations btrfs_dir_ro_inode_operations = {
        .lookup         = btrfs_lookup,
        .permission     = btrfs_permission,
  };
@@@ -5742,7 -5753,7 +5753,7 @@@ static struct extent_io_ops btrfs_exten
   *
   * For now we're avoiding this by dropping bmap.
   */
 -static struct address_space_operations btrfs_aops = {
 +static const struct address_space_operations btrfs_aops = {
        .readpage       = btrfs_readpage,
        .writepage      = btrfs_writepage,
        .writepages     = btrfs_writepages,
        .invalidatepage = btrfs_invalidatepage,
        .releasepage    = btrfs_releasepage,
        .set_page_dirty = btrfs_set_page_dirty,
 +      .error_remove_page = generic_error_remove_page,
  };
  
 -static struct address_space_operations btrfs_symlink_aops = {
 +static const struct address_space_operations btrfs_symlink_aops = {
        .readpage       = btrfs_readpage,
        .writepage      = btrfs_writepage,
        .invalidatepage = btrfs_invalidatepage,
        .releasepage    = btrfs_releasepage,
  };
  
 -static struct inode_operations btrfs_file_inode_operations = {
 +static const struct inode_operations btrfs_file_inode_operations = {
        .truncate       = btrfs_truncate,
        .getattr        = btrfs_getattr,
        .setattr        = btrfs_setattr,
        .fallocate      = btrfs_fallocate,
        .fiemap         = btrfs_fiemap,
  };
 -static struct inode_operations btrfs_special_inode_operations = {
 +static const struct inode_operations btrfs_special_inode_operations = {
        .getattr        = btrfs_getattr,
        .setattr        = btrfs_setattr,
        .permission     = btrfs_permission,
        .listxattr      = btrfs_listxattr,
        .removexattr    = btrfs_removexattr,
  };
 -static struct inode_operations btrfs_symlink_inode_operations = {
 +static const struct inode_operations btrfs_symlink_inode_operations = {
        .readlink       = generic_readlink,
        .follow_link    = page_follow_link_light,
        .put_link       = page_put_link,