[PATCH 1/5] jbd2: Pass extra bool parameter in journal routines to specify if its ok to fail the journal transaction allocation.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <mkatiyar@xxxxxxxxx>
---
 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
From c9edbd8d1da02ada2615acec3e3083b4669f6d9e Mon Sep 17 00:00:00 2001
From: Manish Katiyar <mkatiyar@xxxxxxxxx>
Date: Sun, 24 Apr 2011 00:14:54 -0700
Subject: [PATCH 1/5] 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 else GFP_NOFS is used.

Signed-off-by: Manish Katiyar <mkatiyar@xxxxxxxxx>
---
 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


[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux