aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/inode.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2007-12-18 16:15:09 -0500
committerChris Mason <chris.mason@oracle.com>2008-09-25 11:03:58 -0400
commit6da6abae027e2dbc59bca5f4168b0760f25068c7 (patch)
treea1e9c70c930e8b01baead984b706042067148788 /fs/btrfs/inode.c
parentc59f8951d48c5eb000926935f3ab063d8181d1ee (diff)
Btrfs: Back port to 2.6.18-el kernels
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/inode.c')
-rw-r--r--fs/btrfs/inode.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 686dd03f34f2..6a7d9160df27 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -532,7 +532,11 @@ err:
532 dir->i_size -= name_len * 2; 532 dir->i_size -= name_len * 2;
533 dir->i_mtime = dir->i_ctime = CURRENT_TIME; 533 dir->i_mtime = dir->i_ctime = CURRENT_TIME;
534 btrfs_update_inode(trans, root, dir); 534 btrfs_update_inode(trans, root, dir);
535#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,18)
536 dentry->d_inode->i_nlink--;
537#else
535 drop_nlink(dentry->d_inode); 538 drop_nlink(dentry->d_inode);
539#endif
536 ret = btrfs_update_inode(trans, root, dentry->d_inode); 540 ret = btrfs_update_inode(trans, root, dentry->d_inode);
537 dir->i_sb->s_dirt = 1; 541 dir->i_sb->s_dirt = 1;
538 } 542 }
@@ -1139,7 +1143,7 @@ static unsigned char btrfs_filetype_table[] = {
1139 1143
1140static int btrfs_readdir(struct file *filp, void *dirent, filldir_t filldir) 1144static int btrfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
1141{ 1145{
1142 struct inode *inode = filp->f_path.dentry->d_inode; 1146 struct inode *inode = filp->f_dentry->d_inode;
1143 struct btrfs_root *root = BTRFS_I(inode)->root; 1147 struct btrfs_root *root = BTRFS_I(inode)->root;
1144 struct btrfs_item *item; 1148 struct btrfs_item *item;
1145 struct btrfs_dir_item *di; 1149 struct btrfs_dir_item *di;
@@ -1554,7 +1558,11 @@ static int btrfs_link(struct dentry *old_dentry, struct inode *dir,
1554 if (inode->i_nlink == 0) 1558 if (inode->i_nlink == 0)
1555 return -ENOENT; 1559 return -ENOENT;
1556 1560
1561#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,18)
1562 inode->i_nlink++;
1563#else
1557 inc_nlink(inode); 1564 inc_nlink(inode);
1565#endif
1558 mutex_lock(&root->fs_info->fs_mutex); 1566 mutex_lock(&root->fs_info->fs_mutex);
1559 trans = btrfs_start_transaction(root, 1); 1567 trans = btrfs_start_transaction(root, 1);
1560 1568
@@ -1825,6 +1833,9 @@ insert:
1825 if (ret == -EEXIST) { 1833 if (ret == -EEXIST) {
1826 free_extent_map(em); 1834 free_extent_map(em);
1827 em = NULL; 1835 em = NULL;
1836 if (0 && failed_insert == 1) {
1837 btrfs_drop_extent_cache(inode, start, end);
1838 }
1828 failed_insert++; 1839 failed_insert++;
1829 if (failed_insert > 5) { 1840 if (failed_insert > 5) {
1830 printk("failing to insert %Lu %Lu\n", start, end); 1841 printk("failing to insert %Lu %Lu\n", start, end);
@@ -1942,7 +1953,7 @@ static void btrfs_invalidatepage(struct page *page, unsigned long offset)
1942 */ 1953 */
1943int btrfs_page_mkwrite(struct vm_area_struct *vma, struct page *page) 1954int btrfs_page_mkwrite(struct vm_area_struct *vma, struct page *page)
1944{ 1955{
1945 struct inode *inode = vma->vm_file->f_path.dentry->d_inode; 1956 struct inode *inode = fdentry(vma->vm_file)->d_inode;
1946 unsigned long end; 1957 unsigned long end;
1947 loff_t size; 1958 loff_t size;
1948 int ret = -EINVAL; 1959 int ret = -EINVAL;
@@ -2243,7 +2254,7 @@ static unsigned long force_ra(struct address_space *mapping,
2243} 2254}
2244 2255
2245int btrfs_defrag_file(struct file *file) { 2256int btrfs_defrag_file(struct file *file) {
2246 struct inode *inode = file->f_path.dentry->d_inode; 2257 struct inode *inode = fdentry(file)->d_inode;
2247 struct extent_map_tree *em_tree = &BTRFS_I(inode)->extent_tree; 2258 struct extent_map_tree *em_tree = &BTRFS_I(inode)->extent_tree;
2248 struct page *page; 2259 struct page *page;
2249 unsigned long last_index; 2260 unsigned long last_index;
@@ -2329,7 +2340,7 @@ static int btrfs_ioctl_snap_create(struct btrfs_root *root, void __user *arg)
2329 2340
2330static int btrfs_ioctl_defrag(struct file *file) 2341static int btrfs_ioctl_defrag(struct file *file)
2331{ 2342{
2332 struct inode *inode = file->f_path.dentry->d_inode; 2343 struct inode *inode = fdentry(file)->d_inode;
2333 struct btrfs_root *root = BTRFS_I(inode)->root; 2344 struct btrfs_root *root = BTRFS_I(inode)->root;
2334 2345
2335 switch (inode->i_mode & S_IFMT) { 2346 switch (inode->i_mode & S_IFMT) {
@@ -2350,7 +2361,7 @@ static int btrfs_ioctl_defrag(struct file *file)
2350long btrfs_ioctl(struct file *file, unsigned int 2361long btrfs_ioctl(struct file *file, unsigned int
2351 cmd, unsigned long arg) 2362 cmd, unsigned long arg)
2352{ 2363{
2353 struct btrfs_root *root = BTRFS_I(file->f_path.dentry->d_inode)->root; 2364 struct btrfs_root *root = BTRFS_I(fdentry(file)->d_inode)->root;
2354 2365
2355 switch (cmd) { 2366 switch (cmd) {
2356 case BTRFS_IOC_SNAP_CREATE: 2367 case BTRFS_IOC_SNAP_CREATE: