From: Manish Katiyar Subject: [PATCH 1/5] jbd2: Pass extra bool parameter in journal routines to specify if its ok to fail the journal transaction allocation. Date: Sun, 24 Apr 2011 17:10:41 -0700 Message-ID: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary=001636833ec4ea6d0e04a1b30a06 Cc: Jan Kara , "Theodore Ts'o" To: ext4 Return-path: Received: from mail-qy0-f174.google.com ([209.85.216.174]:43162 "EHLO mail-qy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757803Ab1DYALC (ORCPT ); Sun, 24 Apr 2011 20:11:02 -0400 Received: by qyk7 with SMTP id 7so505969qyk.19 for ; Sun, 24 Apr 2011 17:11:01 -0700 (PDT) Sender: linux-ext4-owner@vger.kernel.org List-ID: --001636833ec4ea6d0e04a1b30a06 Content-Type: text/plain; charset=ISO-8859-1 Pass extra bool parameter in journal routines to specify if its ok to fail the journal transaction allocation. If 'true' is passed transaction allocation is done through GFP_KERNEL and ENOMEM is returned else GFP_NOFS is used. Signed-off-by: Manish Katiyar --- fs/jbd2/transaction.c | 12 +++++++----- include/linux/jbd2.h | 4 ++-- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c index 05fa77a..b02d6a4 100644 --- a/fs/jbd2/transaction.c +++ b/fs/jbd2/transaction.c @@ -349,9 +349,10 @@ handle_t *jbd2__journal_start(journal_t *journal, int nblocks, int gfp_mask) EXPORT_SYMBOL(jbd2__journal_start); -handle_t *jbd2_journal_start(journal_t *journal, int nblocks) +handle_t *jbd2_journal_start(journal_t *journal, int nblocks, bool errok) { - return jbd2__journal_start(journal, nblocks, GFP_NOFS); + return jbd2__journal_start(journal, nblocks, + errok ? GFP_KERNEL : GFP_NOFS); } EXPORT_SYMBOL(jbd2_journal_start); @@ -483,9 +484,10 @@ int jbd2__journal_restart(handle_t *handle, int nblocks, int gfp_mask) EXPORT_SYMBOL(jbd2__journal_restart); -int jbd2_journal_restart(handle_t *handle, int nblocks) +int jbd2_journal_restart(handle_t *handle, int nblocks, bool errok) { - return jbd2__journal_restart(handle, nblocks, GFP_NOFS); + return jbd2__journal_restart(handle, nblocks, + errok ? GFP_KERNEL : GFP_NOFS); } EXPORT_SYMBOL(jbd2_journal_restart); @@ -1436,7 +1438,7 @@ int jbd2_journal_force_commit(journal_t *journal) handle_t *handle; int ret; - handle = jbd2_journal_start(journal, 1); + handle = jbd2_journal_start(journal, 1, false); if (IS_ERR(handle)) { ret = PTR_ERR(handle); } else { diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h index a32dcae..a64aced 100644 --- a/include/linux/jbd2.h +++ b/include/linux/jbd2.h @@ -1103,9 +1103,9 @@ static inline handle_t *journal_current_handle(void) * Register buffer modifications against the current transaction. */ -extern handle_t *jbd2_journal_start(journal_t *, int nblocks); +extern handle_t *jbd2_journal_start(journal_t *, int nblocks, bool errok); extern handle_t *jbd2__journal_start(journal_t *, int nblocks, int gfp_mask); -extern int jbd2_journal_restart(handle_t *, int nblocks); +extern int jbd2_journal_restart(handle_t *, int nblocks, bool errok); extern int jbd2__journal_restart(handle_t *, int nblocks, int gfp_mask); extern int jbd2_journal_extend (handle_t *, int nblocks); extern int jbd2_journal_get_write_access(handle_t *, struct buffer_head *); -- 1.7.1 -- Thanks - Manish --001636833ec4ea6d0e04a1b30a06 Content-Type: text/x-patch; charset=US-ASCII; name="0001-Pass-extra-bool-parameter-in-journal-routines-to-spe.patch" Content-Disposition: attachment; filename="0001-Pass-extra-bool-parameter-in-journal-routines-to-spe.patch" Content-Transfer-Encoding: base64 X-Attachment-Id: f_gmwnhyci0 RnJvbSBjOWVkYmQ4ZDFkYTAyYWRhMjYxNWFjZWMzZTMwODNiNDY2OWY2ZDllIE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBNYW5pc2ggS2F0aXlhciA8bWthdGl5YXJAZ21haWwuY29tPgpE YXRlOiBTdW4sIDI0IEFwciAyMDExIDAwOjE0OjU0IC0w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