inode.c (90290e19820e3323ce6b9c2888eeb68bf29c278b) inode.c (f248679e86fead40cc78e724c7181d6bec1a2046)
1/*
2 * Copyright (C) 2007 Oracle. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public
6 * License v2 as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,

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

2234 /* if we have links, this was a truncate, lets do that */
2235 if (inode->i_nlink) {
2236 if (!S_ISREG(inode->i_mode)) {
2237 WARN_ON(1);
2238 iput(inode);
2239 continue;
2240 }
2241 nr_truncate++;
1/*
2 * Copyright (C) 2007 Oracle. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public
6 * License v2 as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,

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

2234 /* if we have links, this was a truncate, lets do that */
2235 if (inode->i_nlink) {
2236 if (!S_ISREG(inode->i_mode)) {
2237 WARN_ON(1);
2238 iput(inode);
2239 continue;
2240 }
2241 nr_truncate++;
2242 /*
2243 * Need to hold the imutex for reservation purposes, not
2244 * a huge deal here but I have a WARN_ON in
2245 * btrfs_delalloc_reserve_space to catch offenders.
2246 */
2247 mutex_lock(&inode->i_mutex);
2248 ret = btrfs_truncate(inode);
2242 ret = btrfs_truncate(inode);
2249 mutex_unlock(&inode->i_mutex);
2250 } else {
2251 nr_unlink++;
2252 }
2253
2254 /* this will do delete_inode and everything for us */
2255 iput(inode);
2256 if (ret)
2257 goto out;

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

6406 struct extent_state *cached_state = NULL;
6407 char *kaddr;
6408 unsigned long zero_start;
6409 loff_t size;
6410 int ret;
6411 u64 page_start;
6412 u64 page_end;
6413
2243 } else {
2244 nr_unlink++;
2245 }
2246
2247 /* this will do delete_inode and everything for us */
2248 iput(inode);
2249 if (ret)
2250 goto out;

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

6399 struct extent_state *cached_state = NULL;
6400 char *kaddr;
6401 unsigned long zero_start;
6402 loff_t size;
6403 int ret;
6404 u64 page_start;
6405 u64 page_end;
6406
6414 /* Need this to keep space reservations serialized */
6415 mutex_lock(&inode->i_mutex);
6416 ret = btrfs_delalloc_reserve_space(inode, PAGE_CACHE_SIZE);
6407 ret = btrfs_delalloc_reserve_space(inode, PAGE_CACHE_SIZE);
6417 mutex_unlock(&inode->i_mutex);
6418 if (!ret)
6419 ret = btrfs_update_time(vma->vm_file);
6420 if (ret) {
6421 if (ret == -ENOMEM)
6422 ret = VM_FAULT_OOM;
6423 else /* -ENOSPC, -EIO, etc */
6424 ret = VM_FAULT_SIGBUS;
6425 goto out;

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

6753
6754 ei->delayed_node = NULL;
6755
6756 inode = &ei->vfs_inode;
6757 extent_map_tree_init(&ei->extent_tree);
6758 extent_io_tree_init(&ei->io_tree, &inode->i_data);
6759 extent_io_tree_init(&ei->io_failure_tree, &inode->i_data);
6760 mutex_init(&ei->log_mutex);
6408 if (!ret)
6409 ret = btrfs_update_time(vma->vm_file);
6410 if (ret) {
6411 if (ret == -ENOMEM)
6412 ret = VM_FAULT_OOM;
6413 else /* -ENOSPC, -EIO, etc */
6414 ret = VM_FAULT_SIGBUS;
6415 goto out;

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

6743
6744 ei->delayed_node = NULL;
6745
6746 inode = &ei->vfs_inode;
6747 extent_map_tree_init(&ei->extent_tree);
6748 extent_io_tree_init(&ei->io_tree, &inode->i_data);
6749 extent_io_tree_init(&ei->io_failure_tree, &inode->i_data);
6750 mutex_init(&ei->log_mutex);
6751 mutex_init(&ei->delalloc_mutex);
6761 btrfs_ordered_inode_tree_init(&ei->ordered_tree);
6762 INIT_LIST_HEAD(&ei->i_orphan);
6763 INIT_LIST_HEAD(&ei->delalloc_inodes);
6764 INIT_LIST_HEAD(&ei->ordered_operations);
6765 RB_CLEAR_NODE(&ei->rb_node);
6766
6767 return inode;
6768}

--- 723 unchanged lines hidden ---
6752 btrfs_ordered_inode_tree_init(&ei->ordered_tree);
6753 INIT_LIST_HEAD(&ei->i_orphan);
6754 INIT_LIST_HEAD(&ei->delalloc_inodes);
6755 INIT_LIST_HEAD(&ei->ordered_operations);
6756 RB_CLEAR_NODE(&ei->rb_node);
6757
6758 return inode;
6759}

--- 723 unchanged lines hidden ---