]> git.hungrycats.org Git - linux/commitdiff
[XFS] Be explicit in adding in the non-transactional data to the reservation
authorTimothy Shimmin <tes@sgi.com>
Thu, 1 Apr 2004 22:21:32 +0000 (08:21 +1000)
committerNathan Scott <nathans@sgi.com>
Thu, 1 Apr 2004 22:21:32 +0000 (08:21 +1000)
estimate.  We must add in for the worst case of a log stripe taking us the
full distance for a log stripe boundary.

SGI Modid: xfs-linux:xfs-kern:169304a

fs/xfs/xfs_log.c
fs/xfs/xfs_log_priv.h
fs/xfs/xfs_macros.c

index 8d798ac7d29d4de37e7dfc3a33985fd9150a89cd..9ff45c11d3c8d6bf2fa7bdb6965173ed73af2b50 100644 (file)
@@ -3160,6 +3160,7 @@ xlog_ticket_get(xlog_t            *log,
                uint            xflags)
 {
        xlog_ticket_t   *tic;
+       uint            num_headers;
        SPLDECL(s);
 
  alloc:
@@ -3183,21 +3184,30 @@ xlog_ticket_get(xlog_t          *log,
         * in the log.  A unit in this case is the amount of space for one
         * of these log operations.  Normal reservations have a cnt of 1
         * and their unit amount is the total amount of space required.
-        * The following line of code adds one log record header length
-        * for each part of an operation which may fall on a different
-        * log record.
         *
-        * One more XLOG_HEADER_SIZE is added to account for possible
-        * round off errors when syncing a LR to disk.  The bytes are
-        * subtracted if the thread using this ticket is the first writer
-        * to a new LR.
-        *
-        * We add an extra log header for the possibility that the commit
-        * record is the first data written to a new log record.  In this
-        * case it is separate from the rest of the transaction data and
-        * will be charged for the log record header.
+        * The following lines of code account for non-transaction data
+        * which occupy space in the on-disk log. 
         */
-       unit_bytes += log->l_iclog_hsize * (XLOG_BTOLRBB(unit_bytes) + 2);
+
+       /* for start-rec */
+       unit_bytes += sizeof(xlog_op_header_t); 
+
+       /* for padding */
+       if (XFS_SB_VERSION_HASLOGV2(&log->l_mp->m_sb) &&
+               log->l_mp->m_sb.sb_logsunit > 1) {
+               /* log su roundoff */
+               unit_bytes += log->l_mp->m_sb.sb_logsunit;  
+       } else {
+               /* BB roundoff */
+               unit_bytes += BBSIZE;
+        }
+
+       /* for commit-rec */
+       unit_bytes += sizeof(xlog_op_header_t);
+       /* for LR headers */
+       num_headers = ((unit_bytes + log->l_iclog_size-1) >> log->l_iclog_size_log);
+       unit_bytes += log->l_iclog_hsize * num_headers;
 
        tic->t_unit_res         = unit_bytes;
        tic->t_curr_res         = unit_bytes;
index 02bddab09e147840f50cf2bc25a41611e4575626..052de386e9c12b2655cf77063afa91dc7ead74b0 100644 (file)
@@ -57,12 +57,6 @@ struct xfs_mount;
 #define XLOG_RECORD_BSHIFT     14              /* 16384 == 1 << 14 */
 #define XLOG_BIG_RECORD_BSHIFT 15              /* 32k == 1 << 15 */
 #define XLOG_MAX_RECORD_BSHIFT 18              /* 256k == 1 << 18 */
-#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XLOG_BTOLRBB)
-int xlog_btolrbb(int b);
-#define XLOG_BTOLRBB(b)                xlog_btolrbb(b)
-#else
-#define XLOG_BTOLRBB(b)                (((b)+XLOG_RECORD_BSIZE-1) >> XLOG_RECORD_BSHIFT)
-#endif
 #define XLOG_BTOLSUNIT(log, b)  (((b)+(log)->l_mp->m_sb.sb_logsunit-1) / \
                                  (log)->l_mp->m_sb.sb_logsunit)
 #define XLOG_LSUNITTOB(log, su) ((su) * (log)->l_mp->m_sb.sb_logsunit)
@@ -560,6 +554,7 @@ extern void  xlog_put_bp(struct xfs_buf *);
 extern int      xlog_bread(xlog_t *, xfs_daddr_t, int, struct xfs_buf *);
 extern xfs_caddr_t xlog_align(xlog_t *, xfs_daddr_t, int, struct xfs_buf *);
 
+/* iclog tracing */
 #define XLOG_TRACE_GRAB_FLUSH  1
 #define XLOG_TRACE_REL_FLUSH   2
 #define XLOG_TRACE_SLEEP_FLUSH 3
index a6c32c2e055340857c22b2eb272addc4cf62483a..626be21c1e282d239462f63833ddd70e90967745 100644 (file)
@@ -2219,14 +2219,6 @@ xfs_sb_version_toold(unsigned v)
 }
 #endif
 
-#if XFS_WANT_FUNCS_C || (XFS_WANT_SPACE_C && XFSSO_XLOG_BTOLRBB)
-int
-xlog_btolrbb(int b)
-{
-       return XLOG_BTOLRBB(b);
-}
-#endif
-
 #if XFS_WANT_FUNCS_C || (XFS_WANT_SPACE_C && XFSSO_XLOG_GRANT_ADD_SPACE)
 void
 xlog_grant_add_space(xlog_t *log, int bytes, int type)