All of lore.kernel.org
 help / color / mirror / Atom feed
diff for duplicates of <20100723150543.GG13090@thunk.org>

diff --git a/a/1.txt b/N1/1.txt
index 3f8ac50..9b29e06 100644
--- a/a/1.txt
+++ b/N1/1.txt
@@ -4,233 +4,3 @@ there were some missing #include's.
 So once more, this time with feeling...
 
 					- Ted
-
->From d24408e1b50e47b21b7d2ec5857b710e9b752dc9 Mon Sep 17 00:00:00 2001
-From: Theodore Ts'o <tytso@mit.edu>
-Date: Fri, 23 Jul 2010 11:03:45 -0400
-Subject: [PATCH] jbd2: Remove __GFP_NOFAIL from jbd2 layer
-
-__GFP_NOFAIL is going away, so add our own retry loop.  Also add
-jbd2__journal_start() and jbd2__journal_restart() which take a gfp
-mask, so that file systems can optionally (re)start transaction
-handles using GFP_KERNEL.  If they do this, then they need to be
-prepared to handle receiving an PTR_ERR(-ENOMEM) error, and be ready
-to reflect that error up to userspace.
-
-Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
----
- fs/jbd2/journal.c     |   15 +++++++++--
- fs/jbd2/transaction.c |   61 +++++++++++++++++++++++++++++++++---------------
- include/linux/jbd2.h  |    4 ++-
- 3 files changed, 57 insertions(+), 23 deletions(-)
-
-diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
-index f7bf157..a79d334 100644
---- a/fs/jbd2/journal.c
-+++ b/fs/jbd2/journal.c
-@@ -41,6 +41,7 @@
- #include <linux/hash.h>
- #include <linux/log2.h>
- #include <linux/vmalloc.h>
-+#include <linux/backing-dev.h>
- 
- #define CREATE_TRACE_POINTS
- #include <trace/events/jbd2.h>
-@@ -48,8 +49,6 @@
- #include <asm/uaccess.h>
- #include <asm/page.h>
- 
--EXPORT_SYMBOL(jbd2_journal_start);
--EXPORT_SYMBOL(jbd2_journal_restart);
- EXPORT_SYMBOL(jbd2_journal_extend);
- EXPORT_SYMBOL(jbd2_journal_stop);
- EXPORT_SYMBOL(jbd2_journal_lock_updates);
-@@ -311,7 +310,17 @@ int jbd2_journal_write_metadata_buffer(transaction_t *transaction,
- 	 */
- 	J_ASSERT_BH(bh_in, buffer_jbddirty(bh_in));
- 
--	new_bh = alloc_buffer_head(GFP_NOFS|__GFP_NOFAIL);
-+retry_alloc:
-+	new_bh = alloc_buffer_head(GFP_NOFS);
-+	if (!new_bh) {
-+		/*
-+		 * Failure is not an option, but __GFP_NOFAIL is going
-+		 * away; so we retry ourselves here.
-+		 */
-+		congestion_wait(BLK_RW_ASYNC, HZ/50);
-+		goto retry_alloc;
-+	}
-+
- 	/* keep subsequent assertions sane */
- 	new_bh->b_state = 0;
- 	init_buffer(new_bh, NULL, NULL);
-diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c
-index e214d68..001e95f 100644
---- a/fs/jbd2/transaction.c
-+++ b/fs/jbd2/transaction.c
-@@ -26,6 +26,8 @@
- #include <linux/mm.h>
- #include <linux/highmem.h>
- #include <linux/hrtimer.h>
-+#include <linux/backing-dev.h>
-+#include <linux/module.h>
- 
- static void __jbd2_journal_temp_unlink_buffer(struct journal_head *jh);
- 
-@@ -83,30 +85,38 @@ jbd2_get_transaction(journal_t *journal, transaction_t *transaction)
-  * transaction's buffer credits.
-  */
- 
--static int start_this_handle(journal_t *journal, handle_t *handle)
-+static int start_this_handle(journal_t *journal, handle_t *handle,
-+			     int gfp_mask)
- {
- 	transaction_t *transaction;
- 	int needed;
- 	int nblocks = handle->h_buffer_credits;
- 	transaction_t *new_transaction = NULL;
--	int ret = 0;
- 	unsigned long ts = jiffies;
- 
- 	if (nblocks > journal->j_max_transaction_buffers) {
- 		printk(KERN_ERR "JBD: %s wants too many credits (%d > %d)\n",
- 		       current->comm, nblocks,
- 		       journal->j_max_transaction_buffers);
--		ret = -ENOSPC;
--		goto out;
-+		return -ENOSPC;
- 	}
- 
- alloc_transaction:
- 	if (!journal->j_running_transaction) {
--		new_transaction = kzalloc(sizeof(*new_transaction),
--						GFP_NOFS|__GFP_NOFAIL);
-+		new_transaction = kzalloc(sizeof(*new_transaction), gfp_mask);
- 		if (!new_transaction) {
--			ret = -ENOMEM;
--			goto out;
-+			/*
-+			 * If __GFP_FS is not present, then we may be
-+			 * being called from inside the fs writeback
-+			 * layer, so we MUST NOT fail.  Since
-+			 * __GFP_NOFAIL is going away, we will arrange
-+			 * to retry the allocation ourselves.
-+			 */
-+			if ((gfp_mask & __GFP_FS) == 0) {
-+				congestion_wait(BLK_RW_ASYNC, HZ/50);
-+				goto alloc_transaction;
-+			}
-+			return -ENOMEM;
- 		}
- 	}
- 
-@@ -123,8 +133,8 @@ repeat_locked:
- 	if (is_journal_aborted(journal) ||
- 	    (journal->j_errno != 0 && !(journal->j_flags & JBD2_ACK_ERR))) {
- 		spin_unlock(&journal->j_state_lock);
--		ret = -EROFS;
--		goto out;
-+		kfree(new_transaction);
-+		return -EROFS;
- 	}
- 
- 	/* Wait on the journal's transaction barrier if necessary */
-@@ -240,10 +250,8 @@ repeat_locked:
- 	spin_unlock(&journal->j_state_lock);
- 
- 	lock_map_acquire(&handle->h_lockdep_map);
--out:
--	if (unlikely(new_transaction))		/* It's usually NULL */
--		kfree(new_transaction);
--	return ret;
-+	kfree(new_transaction);
-+	return 0;
- }
- 
- static struct lock_class_key jbd2_handle_key;
-@@ -278,7 +286,7 @@ static handle_t *new_handle(int nblocks)
-  *
-  * Return a pointer to a newly allocated handle, or NULL on failure
-  */
--handle_t *jbd2_journal_start(journal_t *journal, int nblocks)
-+handle_t *jbd2__journal_start(journal_t *journal, int nblocks, int gfp_mask)
- {
- 	handle_t *handle = journal_current_handle();
- 	int err;
-@@ -298,7 +306,7 @@ handle_t *jbd2_journal_start(journal_t *journal, int nblocks)
- 
- 	current->journal_info = handle;
- 
--	err = start_this_handle(journal, handle);
-+	err = start_this_handle(journal, handle, gfp_mask);
- 	if (err < 0) {
- 		jbd2_free_handle(handle);
- 		current->journal_info = NULL;
-@@ -308,6 +316,15 @@ handle_t *jbd2_journal_start(journal_t *journal, int nblocks)
- out:
- 	return handle;
- }
-+EXPORT_SYMBOL(jbd2__journal_start);
-+
-+
-+handle_t *jbd2_journal_start(journal_t *journal, int nblocks)
-+{
-+	return jbd2__journal_start(journal, nblocks, GFP_NOFS);
-+}
-+EXPORT_SYMBOL(jbd2_journal_start);
-+
- 
- /**
-  * int jbd2_journal_extend() - extend buffer credits.
-@@ -394,8 +411,7 @@ out:
-  * transaction capabable of guaranteeing the requested number of
-  * credits.
-  */
--
--int jbd2_journal_restart(handle_t *handle, int nblocks)
-+int jbd2__journal_restart(handle_t *handle, int nblocks, int gfp_mask)
- {
- 	transaction_t *transaction = handle->h_transaction;
- 	journal_t *journal = transaction->t_journal;
-@@ -428,10 +444,17 @@ int jbd2_journal_restart(handle_t *handle, int nblocks)
- 
- 	lock_map_release(&handle->h_lockdep_map);
- 	handle->h_buffer_credits = nblocks;
--	ret = start_this_handle(journal, handle);
-+	ret = start_this_handle(journal, handle, gfp_mask);
- 	return ret;
- }
-+EXPORT_SYMBOL(jbd2__journal_restart);
-+
- 
-+int jbd2_journal_restart(handle_t *handle, int nblocks)
-+{
-+	return jbd2__journal_restart(handle, nblocks, GFP_NOFS);
-+}
-+EXPORT_SYMBOL(jbd2_journal_restart);
- 
- /**
-  * void jbd2_journal_lock_updates () - establish a transaction barrier.
-diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
-index a4d2e9f..5a72bc7 100644
---- a/include/linux/jbd2.h
-+++ b/include/linux/jbd2.h
-@@ -1081,7 +1081,9 @@ static inline handle_t *journal_current_handle(void)
-  */
- 
- extern handle_t *jbd2_journal_start(journal_t *, int nblocks);
--extern int	 jbd2_journal_restart (handle_t *, int nblocks);
-+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, int gfp_mask);
- extern int	 jbd2_journal_extend (handle_t *, int nblocks);
- extern int	 jbd2_journal_get_write_access(handle_t *, struct buffer_head *);
- extern int	 jbd2_journal_get_create_access (handle_t *, struct buffer_head *);
--- 
-1.7.0.4
-
---
-To unsubscribe, send a message with 'unsubscribe linux-mm' in
-the body to majordomo@kvack.org.  For more info on Linux MM,
-see: http://www.linux-mm.org/ .
-Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
diff --git a/a/content_digest b/N1/content_digest
index b6c3783..ed1030a 100644
--- a/a/content_digest
+++ b/N1/content_digest
@@ -23,236 +23,6 @@
  "\n"
  "So once more, this time with feeling...\n"
  "\n"
- "\t\t\t\t\t- Ted\n"
- "\n"
- ">From d24408e1b50e47b21b7d2ec5857b710e9b752dc9 Mon Sep 17 00:00:00 2001\n"
- "From: Theodore Ts'o <tytso@mit.edu>\n"
- "Date: Fri, 23 Jul 2010 11:03:45 -0400\n"
- "Subject: [PATCH] jbd2: Remove __GFP_NOFAIL from jbd2 layer\n"
- "\n"
- "__GFP_NOFAIL is going away, so add our own retry loop.  Also add\n"
- "jbd2__journal_start() and jbd2__journal_restart() which take a gfp\n"
- "mask, so that file systems can optionally (re)start transaction\n"
- "handles using GFP_KERNEL.  If they do this, then they need to be\n"
- "prepared to handle receiving an PTR_ERR(-ENOMEM) error, and be ready\n"
- "to reflect that error up to userspace.\n"
- "\n"
- "Signed-off-by: \"Theodore Ts'o\" <tytso@mit.edu>\n"
- "---\n"
- " fs/jbd2/journal.c     |   15 +++++++++--\n"
- " fs/jbd2/transaction.c |   61 +++++++++++++++++++++++++++++++++---------------\n"
- " include/linux/jbd2.h  |    4 ++-\n"
- " 3 files changed, 57 insertions(+), 23 deletions(-)\n"
- "\n"
- "diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c\n"
- "index f7bf157..a79d334 100644\n"
- "--- a/fs/jbd2/journal.c\n"
- "+++ b/fs/jbd2/journal.c\n"
- "@@ -41,6 +41,7 @@\n"
- " #include <linux/hash.h>\n"
- " #include <linux/log2.h>\n"
- " #include <linux/vmalloc.h>\n"
- "+#include <linux/backing-dev.h>\n"
- " \n"
- " #define CREATE_TRACE_POINTS\n"
- " #include <trace/events/jbd2.h>\n"
- "@@ -48,8 +49,6 @@\n"
- " #include <asm/uaccess.h>\n"
- " #include <asm/page.h>\n"
- " \n"
- "-EXPORT_SYMBOL(jbd2_journal_start);\n"
- "-EXPORT_SYMBOL(jbd2_journal_restart);\n"
- " EXPORT_SYMBOL(jbd2_journal_extend);\n"
- " EXPORT_SYMBOL(jbd2_journal_stop);\n"
- " EXPORT_SYMBOL(jbd2_journal_lock_updates);\n"
- "@@ -311,7 +310,17 @@ int jbd2_journal_write_metadata_buffer(transaction_t *transaction,\n"
- " \t */\n"
- " \tJ_ASSERT_BH(bh_in, buffer_jbddirty(bh_in));\n"
- " \n"
- "-\tnew_bh = alloc_buffer_head(GFP_NOFS|__GFP_NOFAIL);\n"
- "+retry_alloc:\n"
- "+\tnew_bh = alloc_buffer_head(GFP_NOFS);\n"
- "+\tif (!new_bh) {\n"
- "+\t\t/*\n"
- "+\t\t * Failure is not an option, but __GFP_NOFAIL is going\n"
- "+\t\t * away; so we retry ourselves here.\n"
- "+\t\t */\n"
- "+\t\tcongestion_wait(BLK_RW_ASYNC, HZ/50);\n"
- "+\t\tgoto retry_alloc;\n"
- "+\t}\n"
- "+\n"
- " \t/* keep subsequent assertions sane */\n"
- " \tnew_bh->b_state = 0;\n"
- " \tinit_buffer(new_bh, NULL, NULL);\n"
- "diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c\n"
- "index e214d68..001e95f 100644\n"
- "--- a/fs/jbd2/transaction.c\n"
- "+++ b/fs/jbd2/transaction.c\n"
- "@@ -26,6 +26,8 @@\n"
- " #include <linux/mm.h>\n"
- " #include <linux/highmem.h>\n"
- " #include <linux/hrtimer.h>\n"
- "+#include <linux/backing-dev.h>\n"
- "+#include <linux/module.h>\n"
- " \n"
- " static void __jbd2_journal_temp_unlink_buffer(struct journal_head *jh);\n"
- " \n"
- "@@ -83,30 +85,38 @@ jbd2_get_transaction(journal_t *journal, transaction_t *transaction)\n"
- "  * transaction's buffer credits.\n"
- "  */\n"
- " \n"
- "-static int start_this_handle(journal_t *journal, handle_t *handle)\n"
- "+static int start_this_handle(journal_t *journal, handle_t *handle,\n"
- "+\t\t\t     int gfp_mask)\n"
- " {\n"
- " \ttransaction_t *transaction;\n"
- " \tint needed;\n"
- " \tint nblocks = handle->h_buffer_credits;\n"
- " \ttransaction_t *new_transaction = NULL;\n"
- "-\tint ret = 0;\n"
- " \tunsigned long ts = jiffies;\n"
- " \n"
- " \tif (nblocks > journal->j_max_transaction_buffers) {\n"
- " \t\tprintk(KERN_ERR \"JBD: %s wants too many credits (%d > %d)\\n\",\n"
- " \t\t       current->comm, nblocks,\n"
- " \t\t       journal->j_max_transaction_buffers);\n"
- "-\t\tret = -ENOSPC;\n"
- "-\t\tgoto out;\n"
- "+\t\treturn -ENOSPC;\n"
- " \t}\n"
- " \n"
- " alloc_transaction:\n"
- " \tif (!journal->j_running_transaction) {\n"
- "-\t\tnew_transaction = kzalloc(sizeof(*new_transaction),\n"
- "-\t\t\t\t\t\tGFP_NOFS|__GFP_NOFAIL);\n"
- "+\t\tnew_transaction = kzalloc(sizeof(*new_transaction), gfp_mask);\n"
- " \t\tif (!new_transaction) {\n"
- "-\t\t\tret = -ENOMEM;\n"
- "-\t\t\tgoto out;\n"
- "+\t\t\t/*\n"
- "+\t\t\t * If __GFP_FS is not present, then we may be\n"
- "+\t\t\t * being called from inside the fs writeback\n"
- "+\t\t\t * layer, so we MUST NOT fail.  Since\n"
- "+\t\t\t * __GFP_NOFAIL is going away, we will arrange\n"
- "+\t\t\t * to retry the allocation ourselves.\n"
- "+\t\t\t */\n"
- "+\t\t\tif ((gfp_mask & __GFP_FS) == 0) {\n"
- "+\t\t\t\tcongestion_wait(BLK_RW_ASYNC, HZ/50);\n"
- "+\t\t\t\tgoto alloc_transaction;\n"
- "+\t\t\t}\n"
- "+\t\t\treturn -ENOMEM;\n"
- " \t\t}\n"
- " \t}\n"
- " \n"
- "@@ -123,8 +133,8 @@ repeat_locked:\n"
- " \tif (is_journal_aborted(journal) ||\n"
- " \t    (journal->j_errno != 0 && !(journal->j_flags & JBD2_ACK_ERR))) {\n"
- " \t\tspin_unlock(&journal->j_state_lock);\n"
- "-\t\tret = -EROFS;\n"
- "-\t\tgoto out;\n"
- "+\t\tkfree(new_transaction);\n"
- "+\t\treturn -EROFS;\n"
- " \t}\n"
- " \n"
- " \t/* Wait on the journal's transaction barrier if necessary */\n"
- "@@ -240,10 +250,8 @@ repeat_locked:\n"
- " \tspin_unlock(&journal->j_state_lock);\n"
- " \n"
- " \tlock_map_acquire(&handle->h_lockdep_map);\n"
- "-out:\n"
- "-\tif (unlikely(new_transaction))\t\t/* It's usually NULL */\n"
- "-\t\tkfree(new_transaction);\n"
- "-\treturn ret;\n"
- "+\tkfree(new_transaction);\n"
- "+\treturn 0;\n"
- " }\n"
- " \n"
- " static struct lock_class_key jbd2_handle_key;\n"
- "@@ -278,7 +286,7 @@ static handle_t *new_handle(int nblocks)\n"
- "  *\n"
- "  * Return a pointer to a newly allocated handle, or NULL on failure\n"
- "  */\n"
- "-handle_t *jbd2_journal_start(journal_t *journal, int nblocks)\n"
- "+handle_t *jbd2__journal_start(journal_t *journal, int nblocks, int gfp_mask)\n"
- " {\n"
- " \thandle_t *handle = journal_current_handle();\n"
- " \tint err;\n"
- "@@ -298,7 +306,7 @@ handle_t *jbd2_journal_start(journal_t *journal, int nblocks)\n"
- " \n"
- " \tcurrent->journal_info = handle;\n"
- " \n"
- "-\terr = start_this_handle(journal, handle);\n"
- "+\terr = start_this_handle(journal, handle, gfp_mask);\n"
- " \tif (err < 0) {\n"
- " \t\tjbd2_free_handle(handle);\n"
- " \t\tcurrent->journal_info = NULL;\n"
- "@@ -308,6 +316,15 @@ handle_t *jbd2_journal_start(journal_t *journal, int nblocks)\n"
- " out:\n"
- " \treturn handle;\n"
- " }\n"
- "+EXPORT_SYMBOL(jbd2__journal_start);\n"
- "+\n"
- "+\n"
- "+handle_t *jbd2_journal_start(journal_t *journal, int nblocks)\n"
- "+{\n"
- "+\treturn jbd2__journal_start(journal, nblocks, GFP_NOFS);\n"
- "+}\n"
- "+EXPORT_SYMBOL(jbd2_journal_start);\n"
- "+\n"
- " \n"
- " /**\n"
- "  * int jbd2_journal_extend() - extend buffer credits.\n"
- "@@ -394,8 +411,7 @@ out:\n"
- "  * transaction capabable of guaranteeing the requested number of\n"
- "  * credits.\n"
- "  */\n"
- "-\n"
- "-int jbd2_journal_restart(handle_t *handle, int nblocks)\n"
- "+int jbd2__journal_restart(handle_t *handle, int nblocks, int gfp_mask)\n"
- " {\n"
- " \ttransaction_t *transaction = handle->h_transaction;\n"
- " \tjournal_t *journal = transaction->t_journal;\n"
- "@@ -428,10 +444,17 @@ int jbd2_journal_restart(handle_t *handle, int nblocks)\n"
- " \n"
- " \tlock_map_release(&handle->h_lockdep_map);\n"
- " \thandle->h_buffer_credits = nblocks;\n"
- "-\tret = start_this_handle(journal, handle);\n"
- "+\tret = start_this_handle(journal, handle, gfp_mask);\n"
- " \treturn ret;\n"
- " }\n"
- "+EXPORT_SYMBOL(jbd2__journal_restart);\n"
- "+\n"
- " \n"
- "+int jbd2_journal_restart(handle_t *handle, int nblocks)\n"
- "+{\n"
- "+\treturn jbd2__journal_restart(handle, nblocks, GFP_NOFS);\n"
- "+}\n"
- "+EXPORT_SYMBOL(jbd2_journal_restart);\n"
- " \n"
- " /**\n"
- "  * void jbd2_journal_lock_updates () - establish a transaction barrier.\n"
- "diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h\n"
- "index a4d2e9f..5a72bc7 100644\n"
- "--- a/include/linux/jbd2.h\n"
- "+++ b/include/linux/jbd2.h\n"
- "@@ -1081,7 +1081,9 @@ static inline handle_t *journal_current_handle(void)\n"
- "  */\n"
- " \n"
- " extern handle_t *jbd2_journal_start(journal_t *, int nblocks);\n"
- "-extern int\t jbd2_journal_restart (handle_t *, int nblocks);\n"
- "+extern handle_t *jbd2__journal_start(journal_t *, int nblocks, int gfp_mask);\n"
- "+extern int\t jbd2_journal_restart(handle_t *, int nblocks);\n"
- "+extern int\t jbd2__journal_restart(handle_t *, int nblocks, int gfp_mask);\n"
- " extern int\t jbd2_journal_extend (handle_t *, int nblocks);\n"
- " extern int\t jbd2_journal_get_write_access(handle_t *, struct buffer_head *);\n"
- " extern int\t jbd2_journal_get_create_access (handle_t *, struct buffer_head *);\n"
- "-- \n"
- "1.7.0.4\n"
- "\n"
- "--\n"
- "To unsubscribe, send a message with 'unsubscribe linux-mm' in\n"
- "the body to majordomo@kvack.org.  For more info on Linux MM,\n"
- "see: http://www.linux-mm.org/ .\n"
- "Don't email: <a href=mailto:\"dont@kvack.org\"> email@kvack.org </a>"
+ "\t\t\t\t\t- Ted"
 
-431c425bb22e913fac84c28761738f785484e898765f7fc38a46811462ad41d9
+5acc5098bf4a0dc831907458d8196d806b5e396cce5bbce757d25dbbf6c361f4

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.