From 950259488e06455d17f29a02d47b2f1ac56f039d Mon Sep 17 00:00:00 2001 From: Jeff Liu Date: Mon, 28 Jan 2013 21:25:35 +0800 Subject: [PATCH] --- yaml --- r: 352927 b: refs/heads/master c: 4f3b57832ba39223c6f8823d07b9fb206e282ced h: refs/heads/master i: 352925: 01104439032142ee806ace13d4d3ffc675572e8d 352923: 711f48ddb60f7c63647a5e714435f7e30899d680 352919: 3e9b0e8edc3fd58a27bb59368d3b635be3c9bd68 352911: df16bb3ce3d4849441e654b79965b5ea0074a466 352895: e61a585d6015ec7b6c1d8cf5746a04aa3640d7de v: v3 --- [refs] | 2 +- trunk/fs/xfs/xfs_trans.c | 31 +++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index d90c3eee9d93..6475e6925e8c 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 2729423cf2ef3ac51d040f24a5ddd84c1b2acc70 +refs/heads/master: 4f3b57832ba39223c6f8823d07b9fb206e282ced diff --git a/trunk/fs/xfs/xfs_trans.c b/trunk/fs/xfs/xfs_trans.c index 06ed520a767f..6c601ea77a9e 100644 --- a/trunk/fs/xfs/xfs_trans.c +++ b/trunk/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 +xfs_buf_log_overhead(void) +{ + return round_up(sizeof(struct xlog_op_header) + + sizeof(struct xfs_buf_log_format), 128); +} + +/* + * Calculate out transaction log reservation per item in bytes. + * + * The nbufs argument is used to indicate the number of items that + * will be changed in a transaction. size is used to tell how many + * bytes should be reserved per item. + */ +STATIC uint +xfs_calc_buf_res( + uint nbufs, + uint size) +{ + return nbufs * (size + xfs_buf_log_overhead()); +} /* * Various log reservation values.