From b9e853f67f8e19da175f0e93b996b8606f5210e3 Mon Sep 17 00:00:00 2001 From: Jeff Mahoney Date: Wed, 3 Sep 2014 09:37:36 -0400 Subject: [PATCH] LU-4416 osd-ldiskfs: limit trans size to match reservations Linux commit 8f7d89f36 (jbd2: transaction reservation support) shrunk the limit of a transaction size to be j_max_transaction_buffers / 2 to accomodate the reservations. This can have a perforamce impact so we limit this change to 3.10+ kernels. The same commit that changed this is the same one that changed the number of arguments to ext4_journal_start function so we use that test for this. This patch adjusts the limit in osd_trans_start to match depending on the kernel version. Signed-off-by: Jeff Mahoney Signed-off-by: James Simmons Change-Id: I10a65474dbaf7b67fe7cd59cc2544759d1e3270d Reviewed-on: http://review.whamcloud.com/10376 Tested-by: Jenkins Reviewed-by: Bob Glossman Tested-by: Maloo Reviewed-by: Andreas Dilger --- lustre/osd-ldiskfs/osd_handler.c | 4 ++-- lustre/osd-ldiskfs/osd_internal.h | 8 ++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/lustre/osd-ldiskfs/osd_handler.c b/lustre/osd-ldiskfs/osd_handler.c index 5ff2ffe..c85d7d5 100644 --- a/lustre/osd-ldiskfs/osd_handler.c +++ b/lustre/osd-ldiskfs/osd_handler.c @@ -890,7 +890,7 @@ static int osd_param_is_not_sane(const struct osd_device *dev, { struct osd_thandle *oh = container_of(th, typeof(*oh), ot_super); - return oh->ot_credits > osd_journal(dev)->j_max_transaction_buffers; + return oh->ot_credits > osd_transaction_size(dev); } /* @@ -1040,7 +1040,7 @@ int osd_trans_start(const struct lu_env *env, struct dt_device *d, * * This should be removed when we can calculate the * credits precisely. */ - oh->ot_credits = osd_journal(dev)->j_max_transaction_buffers; + oh->ot_credits = osd_transaction_size(dev); } /* diff --git a/lustre/osd-ldiskfs/osd_internal.h b/lustre/osd-ldiskfs/osd_internal.h index 39e54e6..06ffc8a 100644 --- a/lustre/osd-ldiskfs/osd_internal.h +++ b/lustre/osd-ldiskfs/osd_internal.h @@ -1089,7 +1089,9 @@ static inline int fid_is_internal(const struct lu_fid *fid) # define osd_ldiskfs_find_entry(dir, name, de, inlined, lock) \ ldiskfs_find_entry(dir, name, de, inlined, lock) # define osd_journal_start(inode, type, nblocks) \ - ldiskfs_journal_start(inode, type, nblocks); + ldiskfs_journal_start(inode, type, nblocks) +# define osd_transaction_size(dev) \ + (osd_journal(dev)->j_max_transaction_buffers / 2) #else # define LDISKFS_HT_MISC 0 # define osd_journal_start_sb(sb, type, nblock) \ @@ -1099,7 +1101,9 @@ static inline int fid_is_internal(const struct lu_fid *fid) # define osd_ldiskfs_find_entry(dir, name, de, inlined, lock) \ ldiskfs_find_entry(dir, name, de, lock) # define osd_journal_start(inode, type, nblocks) \ - ldiskfs_journal_start(inode, nblocks); + ldiskfs_journal_start(inode, nblocks) +# define osd_transaction_size(dev) \ + (osd_journal(dev)->j_max_transaction_buffers) #endif void ldiskfs_inc_count(handle_t *handle, struct inode *inode); -- 1.8.3.1