/* Propogate the priv_object flag so we know we're in the priv tree */
if (is_reiserfs_priv_object (dir))
- REISERFS_I(inode)->i_flags |= i_priv_object;
+ reiserfs_mark_inode_private (inode);
}
reiserfs_write_unlock(dir->i_sb);
if ( retval == IO_ERROR ) {
}
dir->i_size += paste_size;
- dir->i_mtime = dir->i_ctime = CURRENT_TIME;
+ dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC;
if (!S_ISDIR (inode->i_mode) && visible)
// reiserfs_mkdir or reiserfs_rename will do that by itself
reiserfs_update_sd (th, dir);
/* quota utility function, call if you've had to abort after calling
** new_inode_init, and have not called reiserfs_new_inode yet.
-** This should only be called on inodes that do not hav stat data
+** This should only be called on inodes that do not have stat data
** inserted into the tree yet.
*/
static int drop_new_inode(struct inode *inode) {
}
/* utility function that does setup for reiserfs_new_inode.
-** DQUOT_ALLOC_INODE cannot be called inside a transaction, so we had
-** to pull some bits of reiserfs_new_inode out into this func.
-** Yes, the actual quota calls are missing, they are part of the quota
-** patch.
+** DQUOT_INIT needs lots of credits so it's better to have it
+** outside of a transaction, so we had to pull some bits of
+** reiserfs_new_inode out into this func.
*/
static int new_inode_init(struct inode *inode, struct inode *dir, int mode) {
} else {
inode->i_gid = current->fsgid;
}
+ inode->i_xid = vx_current_fsxid(inode->i_sb);
DQUOT_INIT(inode);
- if (DQUOT_ALLOC_INODE(inode)) {
- drop_new_inode(inode);
- return -EDQUOT;
- }
return 0 ;
}
{
int retval;
struct inode * inode;
- int jbegin_count = JOURNAL_PER_BALANCE_CNT * 2 ;
+ /* We need blocks for transaction + (user+group)*(quotas for new inode + update of quota for directory owner) */
+ int jbegin_count = JOURNAL_PER_BALANCE_CNT * 2 + 2 * (REISERFS_QUOTA_INIT_BLOCKS+REISERFS_QUOTA_TRANS_BLOCKS);
struct reiserfs_transaction_handle th ;
int locked;
if (!(inode = new_inode(dir->i_sb))) {
return -ENOMEM ;
}
- retval = new_inode_init(inode, dir, mode);
- if (retval)
- return retval;
+ new_inode_init(inode, dir, mode);
locked = reiserfs_cache_default_acl (dir);
goto out_failed;
}
- retval = reiserfs_new_inode (&th, dir, mode, 0, 0/*i_size*/, dentry, inode);
+ retval = reiserfs_new_inode (&th, dir, mode, NULL, 0/*i_size*/, dentry, inode);
if (retval)
goto out_failed;
int retval;
struct inode * inode;
struct reiserfs_transaction_handle th ;
- int jbegin_count = JOURNAL_PER_BALANCE_CNT * 3;
+ /* We need blocks for transaction + (user+group)*(quotas for new inode + update of quota for directory owner) */
+ int jbegin_count = JOURNAL_PER_BALANCE_CNT * 3 + 2 * (REISERFS_QUOTA_INIT_BLOCKS+REISERFS_QUOTA_TRANS_BLOCKS);
int locked;
if (!new_valid_dev(rdev))
if (!(inode = new_inode(dir->i_sb))) {
return -ENOMEM ;
}
- retval = new_inode_init(inode, dir, mode);
- if (retval)
- return retval;
+ new_inode_init(inode, dir, mode);
locked = reiserfs_cache_default_acl (dir);
int retval;
struct inode * inode;
struct reiserfs_transaction_handle th ;
- int jbegin_count = JOURNAL_PER_BALANCE_CNT * 3;
+ /* We need blocks for transaction + (user+group)*(quotas for new inode + update of quota for directory owner) */
+ int jbegin_count = JOURNAL_PER_BALANCE_CNT * 3 + 2 * (REISERFS_QUOTA_INIT_BLOCKS+REISERFS_QUOTA_TRANS_BLOCKS);
int locked;
#ifdef DISPLACE_NEW_PACKING_LOCALITIES
if (!(inode = new_inode(dir->i_sb))) {
return -ENOMEM ;
}
- retval = new_inode_init(inode, dir, mode);
- if (retval)
- return retval;
+ new_inode_init(inode, dir, mode);
locked = reiserfs_cache_default_acl (dir);
struct reiserfs_dir_entry de;
- /* we will be doing 2 balancings and update 2 stat data */
- jbegin_count = JOURNAL_PER_BALANCE_CNT * 2 + 2;
+ /* we will be doing 2 balancings and update 2 stat data, we change quotas
+ * of the owner of the directory and of the owner of the parent directory */
+ jbegin_count = JOURNAL_PER_BALANCE_CNT * 2 + 2 + 2 * (REISERFS_QUOTA_INIT_BLOCKS+REISERFS_QUOTA_TRANS_BLOCKS);
reiserfs_write_lock(dir->i_sb);
retval = journal_begin(&th, dir->i_sb, jbegin_count) ;
"!= 2 (%d)", __FUNCTION__, inode->i_nlink);
inode->i_nlink = 0;
- inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME;
+ inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME_SEC;
reiserfs_update_sd (&th, inode);
DEC_DIR_INODE_NLINK(dir)
inode = dentry->d_inode;
/* in this transaction we can be doing at max two balancings and update
- two stat datas */
- jbegin_count = JOURNAL_PER_BALANCE_CNT * 2 + 2;
+ two stat datas, we change quotas of the owner of the directory and of
+ the owner of the parent directory */
+ jbegin_count = JOURNAL_PER_BALANCE_CNT * 2 + 2 + 2 * (REISERFS_QUOTA_INIT_BLOCKS+REISERFS_QUOTA_TRANS_BLOCKS);
reiserfs_write_lock(dir->i_sb);
retval = journal_begin(&th, dir->i_sb, jbegin_count) ;
inode->i_nlink++;
goto end_unlink;
}
- inode->i_ctime = CURRENT_TIME;
+ inode->i_ctime = CURRENT_TIME_SEC;
reiserfs_update_sd (&th, inode);
dir->i_size -= (de.de_entrylen + DEH_SIZE);
- dir->i_ctime = dir->i_mtime = CURRENT_TIME;
+ dir->i_ctime = dir->i_mtime = CURRENT_TIME_SEC;
reiserfs_update_sd (&th, dir);
if (!savelink)
int item_len;
struct reiserfs_transaction_handle th ;
int mode = S_IFLNK | S_IRWXUGO;
- int jbegin_count = JOURNAL_PER_BALANCE_CNT * 3;
+ /* We need blocks for transaction + (user+group)*(quotas for new inode + update of quota for directory owner) */
+ int jbegin_count = JOURNAL_PER_BALANCE_CNT * 3 + 2 * (REISERFS_QUOTA_INIT_BLOCKS+REISERFS_QUOTA_TRANS_BLOCKS);
if (!(inode = new_inode(parent_dir->i_sb))) {
return -ENOMEM ;
}
- retval = new_inode_init(inode, parent_dir, mode);
- if (retval) {
- return retval;
- }
+ new_inode_init(inode, parent_dir, mode);
reiserfs_write_lock(parent_dir->i_sb);
item_len = ROUND_UP (strlen (symname));
int retval;
struct inode *inode = old_dentry->d_inode;
struct reiserfs_transaction_handle th ;
- int jbegin_count = JOURNAL_PER_BALANCE_CNT * 3;
+ /* We need blocks for transaction + update of quotas for the owners of the directory */
+ int jbegin_count = JOURNAL_PER_BALANCE_CNT * 3 + 2 * REISERFS_QUOTA_TRANS_BLOCKS;
reiserfs_write_lock(dir->i_sb);
if (inode->i_nlink >= REISERFS_LINK_MAX) {
return err ? err : retval;
}
- inode->i_ctime = CURRENT_TIME;
+ inode->i_ctime = CURRENT_TIME_SEC;
reiserfs_update_sd (&th, inode);
atomic_inc(&inode->i_count) ;
(2) new directory and (3) maybe old object stat data (when it is
directory) and (4) maybe stat data of object to which new entry
pointed initially and (5) maybe block containing ".." of
- renamed directory */
- jbegin_count = JOURNAL_PER_BALANCE_CNT * 3 + 5;
+ renamed directory
+ quota updates: two parent directories */
+ jbegin_count = JOURNAL_PER_BALANCE_CNT * 3 + 5 + 4 * REISERFS_QUOTA_TRANS_BLOCKS;
old_inode = old_dentry->d_inode;
new_dentry_inode = new_dentry->d_inode;
return retval;
}
-
/* add new entry (or find the existing one) */
retval = reiserfs_add_entry (&th, new_dir, new_dentry->d_name.name, new_dentry->d_name.len,
old_inode, 0);
while (1) {
// look for old name using corresponding entry key (found by reiserfs_find_entry)
- if (search_by_entry_key (new_dir->i_sb, &old_de.de_entry_key, &old_entry_path, &old_de) != NAME_FOUND)
- BUG ();
+ if ((retval = search_by_entry_key (new_dir->i_sb, &old_de.de_entry_key,
+ &old_entry_path, &old_de)) != NAME_FOUND) {
+ pathrelse(&old_entry_path);
+ journal_end(&th, old_dir->i_sb, jbegin_count);
+ reiserfs_write_unlock(old_dir->i_sb);
+ return -EIO;
+ }
copy_item_head(&old_entry_ih, get_ih(&old_entry_path)) ;
&new_entry_path, &new_de);
// reiserfs_add_entry should not return IO_ERROR, because it is called with essentially same parameters from
// reiserfs_add_entry above, and we'll catch any i/o errors before we get here.
- if (retval != NAME_FOUND_INVISIBLE && retval != NAME_FOUND)
- BUG ();
+ if (retval != NAME_FOUND_INVISIBLE && retval != NAME_FOUND) {
+ pathrelse(&new_entry_path);
+ pathrelse(&old_entry_path);
+ journal_end(&th, old_dir->i_sb, jbegin_count);
+ reiserfs_write_unlock(old_dir->i_sb);
+ return -EIO;
+ }
copy_item_head(&new_entry_ih, get_ih(&new_entry_path)) ;
reiserfs_prepare_for_journal(old_inode->i_sb, new_de.de_bh, 1) ;
if (S_ISDIR(old_inode->i_mode)) {
- if (search_by_entry_key (new_dir->i_sb, &dot_dot_de.de_entry_key, &dot_dot_entry_path, &dot_dot_de) != NAME_FOUND)
- BUG ();
+ if ((retval = search_by_entry_key (new_dir->i_sb, &dot_dot_de.de_entry_key,
+ &dot_dot_entry_path, &dot_dot_de)) != NAME_FOUND) {
+ pathrelse(&dot_dot_entry_path);
+ pathrelse(&new_entry_path);
+ pathrelse(&old_entry_path);
+ journal_end(&th, old_dir->i_sb, jbegin_count);
+ reiserfs_write_unlock(old_dir->i_sb);
+ return -EIO;
+ }
copy_item_head(&dot_dot_ih, get_ih(&dot_dot_entry_path)) ;
// node containing ".." gets into transaction
reiserfs_prepare_for_journal(old_inode->i_sb, dot_dot_de.de_bh, 1) ;
mark_de_hidden (old_de.de_deh + old_de.de_entry_num);
journal_mark_dirty (&th, old_dir->i_sb, old_de.de_bh);
- ctime = CURRENT_TIME;
+ ctime = CURRENT_TIME_SEC;
old_dir->i_ctime = old_dir->i_mtime = ctime;
new_dir->i_ctime = new_dir->i_mtime = ctime;
/* thanks to Alex Adriaanse <alex_a@caltech.edu> for patch which adds ctime update of