[Top] [All Lists]

Re: [PATCH v2 01/12] xfs: add a helper to figure out the space log reser

To: Jeff Liu <jeff.liu@xxxxxxxxxx>
Subject: Re: [PATCH v2 01/12] xfs: add a helper to figure out the space log reservation per item
From: Mark Tinguely <tinguely@xxxxxxx>
Date: Sat, 19 Jan 2013 12:18:21 -0600
Cc: xfs@xxxxxxxxxxx
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <50FA12D2.7090209@xxxxxxxxxx>
References: <50EEC68A.1030306@xxxxxxxxxx> <50F9D4A5.6050800@xxxxxxx> <50FA12D2.7090209@xxxxxxxxxx>
User-agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:9.0) Gecko/20120122 Thunderbird/9.0
On 01/18/13 21:28, Jeff Liu wrote:
On 01/19/2013 07:03 AM, Mark Tinguely wrote:
On 01/10/13 07:47, Jeff Liu wrote:
Add a helper xfs_calc_buf_res() to calcuate out the space log reservations per 
item which were got
involved in a transaction.  It will call the xfs_buf_log_overhead() to figure 
out the extra space
for the struct xfs_buf_log_format that gets written into the log for every 
buffer as well as a little
bit of extra space because there also needs a log opheader, i.e. struct 

The commit message is too wide.

Signed-off-by: Jie Liu<jeff.liu@xxxxxxxxxx>
   fs/xfs/xfs_trans.c |   31 +++++++++++++++++++++++++++++++
   1 file changed, 31 insertions(+)

diff --git a/fs/xfs/xfs_trans.c b/fs/xfs/xfs_trans.c
index 06ed520..6c601ea 100644
--- a/fs/xfs/xfs_trans.c
+++ b/fs/xfs/xfs_trans.c
@@ -37,14 +37,45 @@
   #include "xfs_extent_busy.h"
   #include "xfs_bmap.h"
   #include "xfs_quota.h"
+#include "xfs_qm.h"
   #include "xfs_trans_priv.h"
   #include "xfs_trans_space.h"
   #include "xfs_inode_item.h"
+#include "xfs_log_priv.h"
+#include "xfs_buf_item.h"
   #include "xfs_trace.h"

   kmem_zone_t  *xfs_trans_zone;
   kmem_zone_t  *xfs_log_item_desc_zone;

+ * A buffer has a format structure overhead in the log in addition
+ * to the data, so we need to take this into account when reserving
+ * space in a transaction for a buffer.  Round the space required up
+ * to a multiple of 128 bytes so that we don't change the historical
+ * reservation that has been used for this overhead.
+ */
+STATIC uint
+       return round_up(sizeof(struct xlog_op_header) +
+                       sizeof(struct xfs_buf_log_format), 128);

Not used directly except below. inline or fold below?
I should be inline.  Maybe it's proper to make xfs_calc_buf_res() inline
as well?

Looks like these routines just get run at boot time - the existing reservations routines that run at boot time are routines too, so you are following the existing style. So I don't want to build a bikeshed so I am flexible on this point.

There appears seems to be some errors in patch 2....


<Prev in Thread] Current Thread [Next in Thread>