aboutsummaryrefslogtreecommitdiffstats
path: root/fs/reiserfs/inode.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/reiserfs/inode.c')
-rw-r--r--fs/reiserfs/inode.c30
1 files changed, 17 insertions, 13 deletions
diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c
index 6c4c2c69449f..55fce92cdf18 100644
--- a/fs/reiserfs/inode.c
+++ b/fs/reiserfs/inode.c
@@ -1753,6 +1753,7 @@ int reiserfs_new_inode(struct reiserfs_transaction_handle *th,
1753 struct inode *inode) 1753 struct inode *inode)
1754{ 1754{
1755 struct super_block *sb; 1755 struct super_block *sb;
1756 struct reiserfs_iget_args args;
1756 INITIALIZE_PATH(path_to_key); 1757 INITIALIZE_PATH(path_to_key);
1757 struct cpu_key key; 1758 struct cpu_key key;
1758 struct item_head ih; 1759 struct item_head ih;
@@ -1780,6 +1781,20 @@ int reiserfs_new_inode(struct reiserfs_transaction_handle *th,
1780 err = -ENOMEM; 1781 err = -ENOMEM;
1781 goto out_bad_inode; 1782 goto out_bad_inode;
1782 } 1783 }
1784 args.objectid = inode->i_ino = le32_to_cpu(ih.ih_key.k_objectid);
1785 if (old_format_only(sb))
1786 make_le_item_head(&ih, NULL, KEY_FORMAT_3_5, SD_OFFSET,
1787 TYPE_STAT_DATA, SD_V1_SIZE, MAX_US_INT);
1788 else
1789 make_le_item_head(&ih, NULL, KEY_FORMAT_3_6, SD_OFFSET,
1790 TYPE_STAT_DATA, SD_SIZE, MAX_US_INT);
1791 memcpy(INODE_PKEY(inode), &(ih.ih_key), KEY_SIZE);
1792 args.dirid = le32_to_cpu(ih.ih_key.k_dir_id);
1793 if (insert_inode_locked4(inode, args.objectid,
1794 reiserfs_find_actor, &args) < 0) {
1795 err = -EINVAL;
1796 goto out_bad_inode;
1797 }
1783 if (old_format_only(sb)) 1798 if (old_format_only(sb))
1784 /* not a perfect generation count, as object ids can be reused, but 1799 /* not a perfect generation count, as object ids can be reused, but
1785 ** this is as good as reiserfs can do right now. 1800 ** this is as good as reiserfs can do right now.
@@ -1825,13 +1840,6 @@ int reiserfs_new_inode(struct reiserfs_transaction_handle *th,
1825 reiserfs_init_acl_default(inode); 1840 reiserfs_init_acl_default(inode);
1826 reiserfs_init_xattr_rwsem(inode); 1841 reiserfs_init_xattr_rwsem(inode);
1827 1842
1828 if (old_format_only(sb))
1829 make_le_item_head(&ih, NULL, KEY_FORMAT_3_5, SD_OFFSET,
1830 TYPE_STAT_DATA, SD_V1_SIZE, MAX_US_INT);
1831 else
1832 make_le_item_head(&ih, NULL, KEY_FORMAT_3_6, SD_OFFSET,
1833 TYPE_STAT_DATA, SD_SIZE, MAX_US_INT);
1834
1835 /* key to search for correct place for new stat data */ 1843 /* key to search for correct place for new stat data */
1836 _make_cpu_key(&key, KEY_FORMAT_3_6, le32_to_cpu(ih.ih_key.k_dir_id), 1844 _make_cpu_key(&key, KEY_FORMAT_3_6, le32_to_cpu(ih.ih_key.k_dir_id),
1837 le32_to_cpu(ih.ih_key.k_objectid), SD_OFFSET, 1845 le32_to_cpu(ih.ih_key.k_objectid), SD_OFFSET,
@@ -1859,13 +1867,9 @@ int reiserfs_new_inode(struct reiserfs_transaction_handle *th,
1859 } else { 1867 } else {
1860 inode2sd(&sd, inode, inode->i_size); 1868 inode2sd(&sd, inode, inode->i_size);
1861 } 1869 }
1862 // these do not go to on-disk stat data
1863 inode->i_ino = le32_to_cpu(ih.ih_key.k_objectid);
1864
1865 // store in in-core inode the key of stat data and version all 1870 // store in in-core inode the key of stat data and version all
1866 // object items will have (directory items will have old offset 1871 // object items will have (directory items will have old offset
1867 // format, other new objects will consist of new items) 1872 // format, other new objects will consist of new items)
1868 memcpy(INODE_PKEY(inode), &(ih.ih_key), KEY_SIZE);
1869 if (old_format_only(sb) || S_ISDIR(mode) || S_ISLNK(mode)) 1873 if (old_format_only(sb) || S_ISDIR(mode) || S_ISLNK(mode))
1870 set_inode_item_key_version(inode, KEY_FORMAT_3_5); 1874 set_inode_item_key_version(inode, KEY_FORMAT_3_5);
1871 else 1875 else
@@ -1929,7 +1933,6 @@ int reiserfs_new_inode(struct reiserfs_transaction_handle *th,
1929 reiserfs_mark_inode_private(inode); 1933 reiserfs_mark_inode_private(inode);
1930 } 1934 }
1931 1935
1932 insert_inode_hash(inode);
1933 reiserfs_update_sd(th, inode); 1936 reiserfs_update_sd(th, inode);
1934 reiserfs_check_path(&path_to_key); 1937 reiserfs_check_path(&path_to_key);
1935 1938
@@ -1956,6 +1959,7 @@ int reiserfs_new_inode(struct reiserfs_transaction_handle *th,
1956 out_inserted_sd: 1959 out_inserted_sd:
1957 inode->i_nlink = 0; 1960 inode->i_nlink = 0;
1958 th->t_trans_id = 0; /* so the caller can't use this handle later */ 1961 th->t_trans_id = 0; /* so the caller can't use this handle later */
1962 unlock_new_inode(inode); /* OK to do even if we hadn't locked it */
1959 1963
1960 /* If we were inheriting an ACL, we need to release the lock so that 1964 /* If we were inheriting an ACL, we need to release the lock so that
1961 * iput doesn't deadlock in reiserfs_delete_xattrs. The locking 1965 * iput doesn't deadlock in reiserfs_delete_xattrs. The locking
@@ -2556,7 +2560,7 @@ static int reiserfs_write_begin(struct file *file,
2556 } 2560 }
2557 2561
2558 index = pos >> PAGE_CACHE_SHIFT; 2562 index = pos >> PAGE_CACHE_SHIFT;
2559 page = __grab_cache_page(mapping, index); 2563 page = grab_cache_page_write_begin(mapping, index, flags);
2560 if (!page) 2564 if (!page)
2561 return -ENOMEM; 2565 return -ENOMEM;
2562 *pagep = page; 2566 *pagep = page;