From 45aa18805df7bd51df575d831b32f178bc31fbe6 Mon Sep 17 00:00:00 2001
From: adilger <adilger>
Date: Tue, 16 Mar 2004 16:05:48 +0000
Subject: [PATCH] Correct number of journal credits calculated for
 FSFILT_OP_CANCEL_UNLINK_LOG so that we don't have transaction errors on small
 MDS filesystems. b=2931 r=tianying

---
 lustre/ChangeLog          |  1 +
 lustre/lvfs/fsfilt_ext3.c | 11 ++++-------
 2 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/lustre/ChangeLog b/lustre/ChangeLog
index f6eed85565..d48da47020 100644
--- a/lustre/ChangeLog
+++ b/lustre/ChangeLog
@@ -12,6 +12,7 @@ tbd  Cluster File Systems, Inc. <info@clusterfs.com>
 	- bump LLOG_CHUNKSIZE to 8k to allow for larger clusters (2306)
 	- fix race in target_handle_connect (2898)
 	- mds_reint_create() should take same inode create lock (2926)
+	- correct journal credits calculated for CANCEL_UNLINK_LOG (2931)
 
 2004-03-04  Cluster File Systems, Inc. <info@clusterfs.com>
        * version 1.2.0
diff --git a/lustre/lvfs/fsfilt_ext3.c b/lustre/lvfs/fsfilt_ext3.c
index 91513f8749..7774eb55cd 100644
--- a/lustre/lvfs/fsfilt_ext3.c
+++ b/lustre/lvfs/fsfilt_ext3.c
@@ -74,11 +74,11 @@ static void *fsfilt_ext3_start(struct inode *inode, int op, void *desc_private)
 {
         /* For updates to the last recieved file */
         int nblocks = EXT3_DATA_TRANS_BLOCKS;
-        int blocksize, block_count = 0;
         void *handle;
 
         if (current->journal_info) {
-                CDEBUG(D_INODE, "increasing refcount on %p\n", current->journal_info);
+                CDEBUG(D_INODE, "increasing refcount on %p\n",
+                       current->journal_info);
                 goto journal_start;
         }
 
@@ -121,11 +121,8 @@ static void *fsfilt_ext3_start(struct inode *inode, int op, void *desc_private)
                 nblocks += 1;
                 break;
         case FSFILT_OP_CANCEL_UNLINK_LOG:
-                blocksize = 1 << inode->i_blkbits;
-                block_count = (blocksize - 1) + LLOG_CHUNK_SIZE;
-                block_count = (block_count + blocksize - 1) >> inode->i_blkbits;
-                block_count = block_count * EXT3_DATA_TRANS_BLOCKS + 2;
-                nblocks = 2 * 2 * block_count;
+                nblocks = (LLOG_CHUNK_SIZE >> inode->i_blkbits) +
+                        EXT3_DELETE_TRANS_BLOCKS;
                 break;
         default: CERROR("unknown transaction start op %d\n", op);
                  LBUG();
-- 
GitLab