* [PATCH] Fix quota transaction size
@ 2005-05-19 9:40 Jan Kara
2005-05-20 0:19 ` Chris Mason
2005-05-20 16:20 ` Jan Kara
0 siblings, 2 replies; 4+ messages in thread
From: Jan Kara @ 2005-05-19 9:40 UTC (permalink / raw)
To: reiserfs-list, linux-fsdevel; +Cc: George Ronkin, mason, akpm
[-- Attachment #1: Type: text/plain, Size: 238 bytes --]
Hello,
attached patch improves the estimates on the number of credits needed
for a quota operation. This is needed as currently quota overflows the
maximum size of a transaction if 1KB blocksize is used. Please apply.
Honza
[-- Attachment #2: quota-2.6.12-rc4-2-lesscredits.diff --]
[-- Type: text/plain, Size: 10259 bytes --]
Improve the estimates on the number of needed credits for quota transaction.
We now distinguish blocks which might need to be allocated and blocks that
only need to be rewritten. Also we distinguish deleting of a quota structure
and creating of a new one.
Signed-off-by: Jan Kara <jack@suse.cz>
diff -rup linux-2.6.12-rc4-reiserassert/fs/ext3/inode.c linux-2.6.12-rc4-quotareserve/fs/ext3/inode.c
--- linux-2.6.12-rc4-reiserassert/fs/ext3/inode.c Sat May 14 13:02:00 2005
+++ linux-2.6.12-rc4-quotareserve/fs/ext3/inode.c Sat May 14 13:50:23 2005
@@ -2763,7 +2763,8 @@ int ext3_setattr(struct dentry *dentry,
/* (user+group)*(old+new) structure, inode write (sb,
* inode block, ? - but truncate inode update has it) */
- handle = ext3_journal_start(inode, 4*EXT3_QUOTA_INIT_BLOCKS+3);
+ handle = ext3_journal_start(inode, 2*(EXT3_QUOTA_INIT_BLOCKS+
+ EXT3_QUOTA_DEL_BLOCKS)+3);
if (IS_ERR(handle)) {
error = PTR_ERR(handle);
goto err_out;
diff -rup linux-2.6.12-rc4-reiserassert/fs/ext3/super.c linux-2.6.12-rc4-quotareserve/fs/ext3/super.c
--- linux-2.6.12-rc4-reiserassert/fs/ext3/super.c Sat May 14 13:02:00 2005
+++ linux-2.6.12-rc4-quotareserve/fs/ext3/super.c Sat May 14 13:55:23 2005
@@ -2246,7 +2246,7 @@ static int ext3_dquot_drop(struct inode
int ret, err;
/* We may delete quota structure so we need to reserve enough blocks */
- handle = ext3_journal_start(inode, 2*EXT3_QUOTA_INIT_BLOCKS);
+ handle = ext3_journal_start(inode, 2*EXT3_QUOTA_DEL_BLOCKS);
if (IS_ERR(handle))
return PTR_ERR(handle);
ret = dquot_drop(inode);
@@ -2296,7 +2296,7 @@ static int ext3_release_dquot(struct dqu
handle_t *handle;
handle = ext3_journal_start(dquot_to_inode(dquot),
- EXT3_QUOTA_INIT_BLOCKS);
+ EXT3_QUOTA_DEL_BLOCKS);
if (IS_ERR(handle))
return PTR_ERR(handle);
ret = dquot_release(dquot);
diff -rup linux-2.6.12-rc4-reiserassert/fs/reiserfs/inode.c linux-2.6.12-rc4-quotareserve/fs/reiserfs/inode.c
--- linux-2.6.12-rc4-reiserassert/fs/reiserfs/inode.c Sat May 14 16:53:47 2005
+++ linux-2.6.12-rc4-quotareserve/fs/reiserfs/inode.c Sat May 14 16:53:01 2005
@@ -2798,10 +2798,10 @@ int reiserfs_setattr(struct dentry *dent
struct reiserfs_transaction_handle th;
/* (user+group)*(old+new) structure - we count quota info and , inode write (sb, inode) */
- journal_begin(&th, inode->i_sb, 4*REISERFS_QUOTA_INIT_BLOCKS+2);
+ journal_begin(&th, inode->i_sb, 2*(REISERFS_QUOTA_INIT_BLOCKS+REISERFS_QUOTA_DEL_BLOCKS)+2);
error = DQUOT_TRANSFER(inode, attr) ? -EDQUOT : 0;
if (error) {
- journal_end(&th, inode->i_sb, 4*REISERFS_QUOTA_INIT_BLOCKS+2);
+ journal_end(&th, inode->i_sb, 2*(REISERFS_QUOTA_INIT_BLOCKS+REISERFS_QUOTA_DEL_BLOCKS)+2);
goto out;
}
/* Update corresponding info in inode so that everything is in
@@ -2811,7 +2811,7 @@ int reiserfs_setattr(struct dentry *dent
if (attr->ia_valid & ATTR_GID)
inode->i_gid = attr->ia_gid;
mark_inode_dirty(inode);
- journal_end(&th, inode->i_sb, 4*REISERFS_QUOTA_INIT_BLOCKS+2);
+ journal_end(&th, inode->i_sb, 2*(REISERFS_QUOTA_INIT_BLOCKS+REISERFS_QUOTA_DEL_BLOCKS)+2);
}
}
if (!error)
diff -rup linux-2.6.12-rc4-reiserassert/fs/reiserfs/namei.c linux-2.6.12-rc4-quotareserve/fs/reiserfs/namei.c
--- linux-2.6.12-rc4-reiserassert/fs/reiserfs/namei.c Sat May 14 16:52:17 2005
+++ linux-2.6.12-rc4-quotareserve/fs/reiserfs/namei.c Sat May 14 17:00:58 2005
@@ -829,8 +829,10 @@ static int reiserfs_rmdir (struct inode
/* 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);
+ * of the owner of the directory and of the owner of the parent directory.
+ * The quota structure is possibly deleted only on last iput => outside
+ * of this transaction */
+ jbegin_count = JOURNAL_PER_BALANCE_CNT * 2 + 2 + 4 * REISERFS_QUOTA_TRANS_BLOCKS;
reiserfs_write_lock(dir->i_sb);
retval = journal_begin(&th, dir->i_sb, jbegin_count) ;
@@ -913,9 +915,10 @@ static int reiserfs_unlink (struct inode
inode = dentry->d_inode;
/* in this transaction we can be doing at max two balancings and update
- 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);
+ * two stat datas, we change quotas of the owner of the directory and of
+ * the owner of the parent directory. The quota structure is possibly
+ * deleted only on iput => outside of this transaction */
+ jbegin_count = JOURNAL_PER_BALANCE_CNT * 2 + 2 + 4 * REISERFS_QUOTA_TRANS_BLOCKS;
reiserfs_write_lock(dir->i_sb);
retval = journal_begin(&th, dir->i_sb, jbegin_count) ;
diff -rup linux-2.6.12-rc4-reiserassert/fs/reiserfs/super.c linux-2.6.12-rc4-quotareserve/fs/reiserfs/super.c
--- linux-2.6.12-rc4-reiserassert/fs/reiserfs/super.c Sat May 14 13:02:01 2005
+++ linux-2.6.12-rc4-quotareserve/fs/reiserfs/super.c Sat May 14 17:01:56 2005
@@ -1857,9 +1857,9 @@ static int reiserfs_dquot_drop(struct in
/* We may delete quota structure so we need to reserve enough blocks */
reiserfs_write_lock(inode->i_sb);
- journal_begin(&th, inode->i_sb, 2*REISERFS_QUOTA_INIT_BLOCKS);
+ journal_begin(&th, inode->i_sb, 2*REISERFS_QUOTA_DEL_BLOCKS);
ret = dquot_drop(inode);
- journal_end(&th, inode->i_sb, 2*REISERFS_QUOTA_INIT_BLOCKS);
+ journal_end(&th, inode->i_sb, 2*REISERFS_QUOTA_DEL_BLOCKS);
reiserfs_write_unlock(inode->i_sb);
return ret;
}
@@ -1896,9 +1896,9 @@ static int reiserfs_release_dquot(struct
int ret;
reiserfs_write_lock(dquot->dq_sb);
- journal_begin(&th, dquot->dq_sb, REISERFS_QUOTA_INIT_BLOCKS);
+ journal_begin(&th, dquot->dq_sb, REISERFS_QUOTA_DEL_BLOCKS);
ret = dquot_release(dquot);
- journal_end(&th, dquot->dq_sb, REISERFS_QUOTA_INIT_BLOCKS);
+ journal_end(&th, dquot->dq_sb, REISERFS_QUOTA_DEL_BLOCKS);
reiserfs_write_unlock(dquot->dq_sb);
return ret;
}
diff -rup linux-2.6.12-rc4-reiserassert/include/linux/dqblk_v1.h linux-2.6.12-rc4-quotareserve/include/linux/dqblk_v1.h
--- linux-2.6.12-rc4-reiserassert/include/linux/dqblk_v1.h Wed Mar 2 08:38:08 2005
+++ linux-2.6.12-rc4-quotareserve/include/linux/dqblk_v1.h Sat May 14 13:43:55 2005
@@ -11,6 +11,12 @@
/* Root squash turned on */
#define V1_DQF_RSQUASH 1
+/* Numbers of blocks needed for updates */
+#define V1_INIT_ALLOC 1
+#define V1_INIT_REWRITE 1
+#define V1_DEL_ALLOC 0
+#define V1_DEL_REWRITE 2
+
/* Special information about quotafile */
struct v1_mem_dqinfo {
};
diff -rup linux-2.6.12-rc4-reiserassert/include/linux/dqblk_v2.h linux-2.6.12-rc4-quotareserve/include/linux/dqblk_v2.h
--- linux-2.6.12-rc4-reiserassert/include/linux/dqblk_v2.h Wed Mar 2 08:37:53 2005
+++ linux-2.6.12-rc4-quotareserve/include/linux/dqblk_v2.h Sat May 14 13:44:04 2005
@@ -10,6 +10,12 @@
/* id numbers of quota format */
#define QFMT_VFS_V0 2
+/* Numbers of blocks needed for updates */
+#define V2_INIT_ALLOC 4
+#define V2_INIT_REWRITE 2
+#define V2_DEL_ALLOC 0
+#define V2_DEL_REWRITE 6
+
/* Inmemory copy of version specific information */
struct v2_mem_dqinfo {
unsigned int dqi_blocks;
diff -rup linux-2.6.12-rc4-reiserassert/include/linux/ext3_jbd.h linux-2.6.12-rc4-quotareserve/include/linux/ext3_jbd.h
--- linux-2.6.12-rc4-reiserassert/include/linux/ext3_jbd.h Sat May 14 13:02:06 2005
+++ linux-2.6.12-rc4-quotareserve/include/linux/ext3_jbd.h Sat May 14 13:48:06 2005
@@ -77,8 +77,10 @@
#define EXT3_QUOTA_TRANS_BLOCKS 2
/* Amount of blocks needed for quota insert/delete - we do some block writes
* but inode, sb and group updates are done only once */
-#define EXT3_QUOTA_INIT_BLOCKS (DQUOT_MAX_WRITES*\
- (EXT3_SINGLEDATA_TRANS_BLOCKS-3)+3)
+#define EXT3_QUOTA_INIT_BLOCKS (DQUOT_INIT_ALLOC*\
+ (EXT3_SINGLEDATA_TRANS_BLOCKS-3)+3+DQUOT_INIT_REWRITE)
+#define EXT3_QUOTA_DEL_BLOCKS (DQUOT_DEL_ALLOC*\
+ (EXT3_SINGLEDATA_TRANS_BLOCKS-3)+3+DQUOT_DEL_REWRITE)
#else
#define EXT3_QUOTA_TRANS_BLOCKS 0
#define EXT3_QUOTA_INIT_BLOCKS 0
diff -rup linux-2.6.12-rc4-reiserassert/include/linux/quota.h linux-2.6.12-rc4-quotareserve/include/linux/quota.h
--- linux-2.6.12-rc4-reiserassert/include/linux/quota.h Wed Mar 2 08:38:17 2005
+++ linux-2.6.12-rc4-quotareserve/include/linux/quota.h Sat May 14 13:43:50 2005
@@ -138,8 +138,11 @@ struct if_dqinfo {
#include <linux/dqblk_v2.h>
/* Maximal numbers of writes for quota operation (insert/delete/update)
- * (over all formats) - info block, 4 pointer blocks, data block */
-#define DQUOT_MAX_WRITES 6
+ * (over VFS all formats) */
+#define DQUOT_INIT_ALLOC max(V1_INIT_ALLOC, V2_INIT_ALLOC)
+#define DQUOT_INIT_REWRITE max(V1_INIT_REWRITE, V2_INIT_REWRITE)
+#define DQUOT_DEL_ALLOC max(V1_DEL_ALLOC, V2_DEL_ALLOC)
+#define DQUOT_DEL_REWRITE max(V1_DEL_REWRITE, V2_DEL_REWRITE)
/*
* Data for one user/group kept in memory
diff -rup linux-2.6.12-rc4-reiserassert/include/linux/reiserfs_fs.h linux-2.6.12-rc4-quotareserve/include/linux/reiserfs_fs.h
--- linux-2.6.12-rc4-reiserassert/include/linux/reiserfs_fs.h Sat May 14 16:46:05 2005
+++ linux-2.6.12-rc4-quotareserve/include/linux/reiserfs_fs.h Sat May 14 16:46:14 2005
@@ -1645,7 +1645,8 @@ struct reiserfs_journal_header {
#define JOURNAL_PER_BALANCE_CNT (3 * (MAX_HEIGHT-2) + 9)
#ifdef CONFIG_QUOTA
#define REISERFS_QUOTA_TRANS_BLOCKS 2 /* We need to update data and inode (atime) */
-#define REISERFS_QUOTA_INIT_BLOCKS (DQUOT_MAX_WRITES*(JOURNAL_PER_BALANCE_CNT+2)+1) /* 1 balancing, 1 bitmap, 1 data per write + stat data update */
+#define REISERFS_QUOTA_INIT_BLOCKS (DQUOT_INIT_ALLOC*(JOURNAL_PER_BALANCE_CNT+2)+DQUOT_INIT_REWRITE+1) /* 1 balancing, 1 bitmap, 1 data per write + stat data update */
+#define REISERFS_QUOTA_DEL_BLOCKS (DQUOT_DEL_ALLOC*(JOURNAL_PER_BALANCE_CNT+2)+DQUOT_DEL_REWRITE+1) /* same as with INIT */
#else
#define REISERFS_QUOTA_TRANS_BLOCKS 0
#define REISERFS_QUOTA_INIT_BLOCKS 0
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Fix quota transaction size
2005-05-19 9:40 [PATCH] Fix quota transaction size Jan Kara
@ 2005-05-20 0:19 ` Chris Mason
2005-05-20 9:44 ` Jan Kara
2005-05-20 16:20 ` Jan Kara
1 sibling, 1 reply; 4+ messages in thread
From: Chris Mason @ 2005-05-20 0:19 UTC (permalink / raw)
To: Jan Kara; +Cc: reiserfs-list, linux-fsdevel, George Ronkin, akpm
On Thursday 19 May 2005 05:40, Jan Kara wrote:
> Hello,
>
> attached patch improves the estimates on the number of credits needed
> for a quota operation. This is needed as currently quota overflows the
> maximum size of a transaction if 1KB blocksize is used. Please apply.
Thanks Jan,
It would make more sense to only allocate for the quota if quotas are in use.
When you have 10 or more concurrent procs unlinking things, they end up
waiting for each other because they are trying to reserve so many blocks in
the transaction. So, a smaller reservation allows for better concurrency
when quotas are off.
-chris
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Fix quota transaction size
2005-05-20 0:19 ` Chris Mason
@ 2005-05-20 9:44 ` Jan Kara
0 siblings, 0 replies; 4+ messages in thread
From: Jan Kara @ 2005-05-20 9:44 UTC (permalink / raw)
To: Chris Mason; +Cc: reiserfs-list, linux-fsdevel, George Ronkin, akpm
Hello,
> On Thursday 19 May 2005 05:40, Jan Kara wrote:
> > Hello,
> >
> > attached patch improves the estimates on the number of credits needed
> > for a quota operation. This is needed as currently quota overflows the
> > maximum size of a transaction if 1KB blocksize is used. Please apply.
>
> Thanks Jan,
>
> It would make more sense to only allocate for the quota if quotas are
> in use. When you have 10 or more concurrent procs unlinking things,
> they end up waiting for each other because they are trying to reserve
> so many blocks in the transaction. So, a smaller reservation allows
> for better concurrency when quotas are off.
That's a good point. Checking whether the quota is enabled on a
transaction start is probably not a good option as quotas can be turned
on while some transaction is in progress. But we may check whether the
filesystem was mounted with some quota option (better set some
superblock flag when it is so) and reserve a space in a transaction for
quotas in that case. Mount options can be changed only on remounting
which nicely synchronizes everything anyway. And running a filesystem
with quota options but without quota turned on is probably a case
which can suffer some penalty. I'll write the patch for this.
Honza
--
Jan Kara <jack@suse.cz>
SuSE CR Labs
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Fix quota transaction size
2005-05-19 9:40 [PATCH] Fix quota transaction size Jan Kara
2005-05-20 0:19 ` Chris Mason
@ 2005-05-20 16:20 ` Jan Kara
1 sibling, 0 replies; 4+ messages in thread
From: Jan Kara @ 2005-05-20 16:20 UTC (permalink / raw)
To: reiserfs-list, linux-fsdevel; +Cc: George Ronkin, mason, akpm
[-- Attachment #1: Type: text/plain, Size: 412 bytes --]
> Hello,
>
> attached patch improves the estimates on the number of credits needed
> for a quota operation. This is needed as currently quota overflows the
> maximum size of a transaction if 1KB blocksize is used. Please apply.
>
Sorry for replying to myself but I just found out that this patch did
not compile without CONFIG_QUOTA. Attached patch was tested to compile
also without it.
Honza
[-- Attachment #2: quota-2.6.12-rc4-2-lesscredits.diff --]
[-- Type: text/plain, Size: 10960 bytes --]
Improve estimates on the number of needed credits for quota transaction.
Now we distinguish blocks that might need to be allocated and blocks that
only need to be rewritten. Also we distinguish deleting of a quota structure
and creating of a new one.
Signed-off-by: Jan Kara <jack@suse.cz>
diff -rupX /home/jack/.kerndiffexclude linux-2.6.12-rc4-1-reiserbigtrans/fs/ext3/inode.c linux-2.6.12-rc4-2-credits/fs/ext3/inode.c
--- linux-2.6.12-rc4-1-reiserbigtrans/fs/ext3/inode.c 2005-05-18 15:10:55.000000000 +0200
+++ linux-2.6.12-rc4-2-credits/fs/ext3/inode.c 2005-05-18 15:18:12.000000000 +0200
@@ -2763,7 +2763,8 @@ int ext3_setattr(struct dentry *dentry,
/* (user+group)*(old+new) structure, inode write (sb,
* inode block, ? - but truncate inode update has it) */
- handle = ext3_journal_start(inode, 4*EXT3_QUOTA_INIT_BLOCKS+3);
+ handle = ext3_journal_start(inode, 2*(EXT3_QUOTA_INIT_BLOCKS+
+ EXT3_QUOTA_DEL_BLOCKS)+3);
if (IS_ERR(handle)) {
error = PTR_ERR(handle);
goto err_out;
diff -rupX /home/jack/.kerndiffexclude linux-2.6.12-rc4-1-reiserbigtrans/fs/ext3/super.c linux-2.6.12-rc4-2-credits/fs/ext3/super.c
--- linux-2.6.12-rc4-1-reiserbigtrans/fs/ext3/super.c 2005-05-18 15:10:55.000000000 +0200
+++ linux-2.6.12-rc4-2-credits/fs/ext3/super.c 2005-05-18 15:18:12.000000000 +0200
@@ -2246,7 +2246,7 @@ static int ext3_dquot_drop(struct inode
int ret, err;
/* We may delete quota structure so we need to reserve enough blocks */
- handle = ext3_journal_start(inode, 2*EXT3_QUOTA_INIT_BLOCKS);
+ handle = ext3_journal_start(inode, 2*EXT3_QUOTA_DEL_BLOCKS);
if (IS_ERR(handle))
return PTR_ERR(handle);
ret = dquot_drop(inode);
@@ -2296,7 +2296,7 @@ static int ext3_release_dquot(struct dqu
handle_t *handle;
handle = ext3_journal_start(dquot_to_inode(dquot),
- EXT3_QUOTA_INIT_BLOCKS);
+ EXT3_QUOTA_DEL_BLOCKS);
if (IS_ERR(handle))
return PTR_ERR(handle);
ret = dquot_release(dquot);
diff -rupX /home/jack/.kerndiffexclude linux-2.6.12-rc4-1-reiserbigtrans/fs/reiserfs/inode.c linux-2.6.12-rc4-2-credits/fs/reiserfs/inode.c
--- linux-2.6.12-rc4-1-reiserbigtrans/fs/reiserfs/inode.c 2005-05-18 15:10:59.000000000 +0200
+++ linux-2.6.12-rc4-2-credits/fs/reiserfs/inode.c 2005-05-18 15:18:12.000000000 +0200
@@ -2798,10 +2798,10 @@ int reiserfs_setattr(struct dentry *dent
struct reiserfs_transaction_handle th;
/* (user+group)*(old+new) structure - we count quota info and , inode write (sb, inode) */
- journal_begin(&th, inode->i_sb, 4*REISERFS_QUOTA_INIT_BLOCKS+2);
+ journal_begin(&th, inode->i_sb, 2*(REISERFS_QUOTA_INIT_BLOCKS+REISERFS_QUOTA_DEL_BLOCKS)+2);
error = DQUOT_TRANSFER(inode, attr) ? -EDQUOT : 0;
if (error) {
- journal_end(&th, inode->i_sb, 4*REISERFS_QUOTA_INIT_BLOCKS+2);
+ journal_end(&th, inode->i_sb, 2*(REISERFS_QUOTA_INIT_BLOCKS+REISERFS_QUOTA_DEL_BLOCKS)+2);
goto out;
}
/* Update corresponding info in inode so that everything is in
@@ -2811,7 +2811,7 @@ int reiserfs_setattr(struct dentry *dent
if (attr->ia_valid & ATTR_GID)
inode->i_gid = attr->ia_gid;
mark_inode_dirty(inode);
- journal_end(&th, inode->i_sb, 4*REISERFS_QUOTA_INIT_BLOCKS+2);
+ journal_end(&th, inode->i_sb, 2*(REISERFS_QUOTA_INIT_BLOCKS+REISERFS_QUOTA_DEL_BLOCKS)+2);
}
}
if (!error)
diff -rupX /home/jack/.kerndiffexclude linux-2.6.12-rc4-1-reiserbigtrans/fs/reiserfs/namei.c linux-2.6.12-rc4-2-credits/fs/reiserfs/namei.c
--- linux-2.6.12-rc4-1-reiserbigtrans/fs/reiserfs/namei.c 2005-05-18 15:10:59.000000000 +0200
+++ linux-2.6.12-rc4-2-credits/fs/reiserfs/namei.c 2005-05-18 15:18:12.000000000 +0200
@@ -829,8 +829,10 @@ static int reiserfs_rmdir (struct inode
/* 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);
+ * of the owner of the directory and of the owner of the parent directory.
+ * The quota structure is possibly deleted only on last iput => outside
+ * of this transaction */
+ jbegin_count = JOURNAL_PER_BALANCE_CNT * 2 + 2 + 4 * REISERFS_QUOTA_TRANS_BLOCKS;
reiserfs_write_lock(dir->i_sb);
retval = journal_begin(&th, dir->i_sb, jbegin_count) ;
@@ -913,9 +915,10 @@ static int reiserfs_unlink (struct inode
inode = dentry->d_inode;
/* in this transaction we can be doing at max two balancings and update
- 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);
+ * two stat datas, we change quotas of the owner of the directory and of
+ * the owner of the parent directory. The quota structure is possibly
+ * deleted only on iput => outside of this transaction */
+ jbegin_count = JOURNAL_PER_BALANCE_CNT * 2 + 2 + 4 * REISERFS_QUOTA_TRANS_BLOCKS;
reiserfs_write_lock(dir->i_sb);
retval = journal_begin(&th, dir->i_sb, jbegin_count) ;
diff -rupX /home/jack/.kerndiffexclude linux-2.6.12-rc4-1-reiserbigtrans/fs/reiserfs/super.c linux-2.6.12-rc4-2-credits/fs/reiserfs/super.c
--- linux-2.6.12-rc4-1-reiserbigtrans/fs/reiserfs/super.c 2005-05-18 15:10:59.000000000 +0200
+++ linux-2.6.12-rc4-2-credits/fs/reiserfs/super.c 2005-05-18 15:18:12.000000000 +0200
@@ -1857,9 +1857,9 @@ static int reiserfs_dquot_drop(struct in
/* We may delete quota structure so we need to reserve enough blocks */
reiserfs_write_lock(inode->i_sb);
- journal_begin(&th, inode->i_sb, 2*REISERFS_QUOTA_INIT_BLOCKS);
+ journal_begin(&th, inode->i_sb, 2*REISERFS_QUOTA_DEL_BLOCKS);
ret = dquot_drop(inode);
- journal_end(&th, inode->i_sb, 2*REISERFS_QUOTA_INIT_BLOCKS);
+ journal_end(&th, inode->i_sb, 2*REISERFS_QUOTA_DEL_BLOCKS);
reiserfs_write_unlock(inode->i_sb);
return ret;
}
@@ -1896,9 +1896,9 @@ static int reiserfs_release_dquot(struct
int ret;
reiserfs_write_lock(dquot->dq_sb);
- journal_begin(&th, dquot->dq_sb, REISERFS_QUOTA_INIT_BLOCKS);
+ journal_begin(&th, dquot->dq_sb, REISERFS_QUOTA_DEL_BLOCKS);
ret = dquot_release(dquot);
- journal_end(&th, dquot->dq_sb, REISERFS_QUOTA_INIT_BLOCKS);
+ journal_end(&th, dquot->dq_sb, REISERFS_QUOTA_DEL_BLOCKS);
reiserfs_write_unlock(dquot->dq_sb);
return ret;
}
diff -rupX /home/jack/.kerndiffexclude linux-2.6.12-rc4-1-reiserbigtrans/include/linux/dqblk_v1.h linux-2.6.12-rc4-2-credits/include/linux/dqblk_v1.h
--- linux-2.6.12-rc4-1-reiserbigtrans/include/linux/dqblk_v1.h 2004-10-18 23:54:07.000000000 +0200
+++ linux-2.6.12-rc4-2-credits/include/linux/dqblk_v1.h 2005-05-18 15:18:12.000000000 +0200
@@ -11,6 +11,12 @@
/* Root squash turned on */
#define V1_DQF_RSQUASH 1
+/* Numbers of blocks needed for updates */
+#define V1_INIT_ALLOC 1
+#define V1_INIT_REWRITE 1
+#define V1_DEL_ALLOC 0
+#define V1_DEL_REWRITE 2
+
/* Special information about quotafile */
struct v1_mem_dqinfo {
};
diff -rupX /home/jack/.kerndiffexclude linux-2.6.12-rc4-1-reiserbigtrans/include/linux/dqblk_v2.h linux-2.6.12-rc4-2-credits/include/linux/dqblk_v2.h
--- linux-2.6.12-rc4-1-reiserbigtrans/include/linux/dqblk_v2.h 2004-10-18 23:53:46.000000000 +0200
+++ linux-2.6.12-rc4-2-credits/include/linux/dqblk_v2.h 2005-05-18 15:18:12.000000000 +0200
@@ -10,6 +10,12 @@
/* id numbers of quota format */
#define QFMT_VFS_V0 2
+/* Numbers of blocks needed for updates */
+#define V2_INIT_ALLOC 4
+#define V2_INIT_REWRITE 2
+#define V2_DEL_ALLOC 0
+#define V2_DEL_REWRITE 6
+
/* Inmemory copy of version specific information */
struct v2_mem_dqinfo {
unsigned int dqi_blocks;
diff -rupX /home/jack/.kerndiffexclude linux-2.6.12-rc4-1-reiserbigtrans/include/linux/ext3_jbd.h linux-2.6.12-rc4-2-credits/include/linux/ext3_jbd.h
--- linux-2.6.12-rc4-1-reiserbigtrans/include/linux/ext3_jbd.h 2005-05-18 15:11:06.000000000 +0200
+++ linux-2.6.12-rc4-2-credits/include/linux/ext3_jbd.h 2005-05-20 17:10:23.000000000 +0200
@@ -77,11 +77,14 @@
#define EXT3_QUOTA_TRANS_BLOCKS 2
/* Amount of blocks needed for quota insert/delete - we do some block writes
* but inode, sb and group updates are done only once */
-#define EXT3_QUOTA_INIT_BLOCKS (DQUOT_MAX_WRITES*\
- (EXT3_SINGLEDATA_TRANS_BLOCKS-3)+3)
+#define EXT3_QUOTA_INIT_BLOCKS (DQUOT_INIT_ALLOC*\
+ (EXT3_SINGLEDATA_TRANS_BLOCKS-3)+3+DQUOT_INIT_REWRITE)
+#define EXT3_QUOTA_DEL_BLOCKS (DQUOT_DEL_ALLOC*\
+ (EXT3_SINGLEDATA_TRANS_BLOCKS-3)+3+DQUOT_DEL_REWRITE)
#else
#define EXT3_QUOTA_TRANS_BLOCKS 0
#define EXT3_QUOTA_INIT_BLOCKS 0
+#define EXT3_QUOTA_DEL_BLOCKS 0
#endif
int
diff -rupX /home/jack/.kerndiffexclude linux-2.6.12-rc4-1-reiserbigtrans/include/linux/quota.h linux-2.6.12-rc4-2-credits/include/linux/quota.h
--- linux-2.6.12-rc4-1-reiserbigtrans/include/linux/quota.h 2005-03-03 18:58:41.000000000 +0100
+++ linux-2.6.12-rc4-2-credits/include/linux/quota.h 2005-05-18 15:18:12.000000000 +0200
@@ -138,8 +138,11 @@ struct if_dqinfo {
#include <linux/dqblk_v2.h>
/* Maximal numbers of writes for quota operation (insert/delete/update)
- * (over all formats) - info block, 4 pointer blocks, data block */
-#define DQUOT_MAX_WRITES 6
+ * (over VFS all formats) */
+#define DQUOT_INIT_ALLOC max(V1_INIT_ALLOC, V2_INIT_ALLOC)
+#define DQUOT_INIT_REWRITE max(V1_INIT_REWRITE, V2_INIT_REWRITE)
+#define DQUOT_DEL_ALLOC max(V1_DEL_ALLOC, V2_DEL_ALLOC)
+#define DQUOT_DEL_REWRITE max(V1_DEL_REWRITE, V2_DEL_REWRITE)
/*
* Data for one user/group kept in memory
diff -rupX /home/jack/.kerndiffexclude linux-2.6.12-rc4-1-reiserbigtrans/include/linux/reiserfs_fs.h linux-2.6.12-rc4-2-credits/include/linux/reiserfs_fs.h
--- linux-2.6.12-rc4-1-reiserbigtrans/include/linux/reiserfs_fs.h 2005-05-18 15:11:10.000000000 +0200
+++ linux-2.6.12-rc4-2-credits/include/linux/reiserfs_fs.h 2005-05-20 17:09:22.000000000 +0200
@@ -1645,10 +1645,12 @@ struct reiserfs_journal_header {
#define JOURNAL_PER_BALANCE_CNT (3 * (MAX_HEIGHT-2) + 9)
#ifdef CONFIG_QUOTA
#define REISERFS_QUOTA_TRANS_BLOCKS 2 /* We need to update data and inode (atime) */
-#define REISERFS_QUOTA_INIT_BLOCKS (DQUOT_MAX_WRITES*(JOURNAL_PER_BALANCE_CNT+2)+1) /* 1 balancing, 1 bitmap, 1 data per write + stat data update */
+#define REISERFS_QUOTA_INIT_BLOCKS (DQUOT_INIT_ALLOC*(JOURNAL_PER_BALANCE_CNT+2)+DQUOT_INIT_REWRITE+1) /* 1 balancing, 1 bitmap, 1 data per write + stat data update */
+#define REISERFS_QUOTA_DEL_BLOCKS (DQUOT_DEL_ALLOC*(JOURNAL_PER_BALANCE_CNT+2)+DQUOT_DEL_REWRITE+1) /* same as with INIT */
#else
#define REISERFS_QUOTA_TRANS_BLOCKS 0
#define REISERFS_QUOTA_INIT_BLOCKS 0
+#define REISERFS_QUOTA_DEL_BLOCKS 0
#endif
/* both of these can be as low as 1, or as high as you want. The min is the
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2005-05-20 16:20 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-19 9:40 [PATCH] Fix quota transaction size Jan Kara
2005-05-20 0:19 ` Chris Mason
2005-05-20 9:44 ` Jan Kara
2005-05-20 16:20 ` Jan Kara
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).