[PATCH 1/3] jbd2 : Make jbd2 transaction handle allocation to return errors and handle them gracefully.

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

 



 Hi Jan,

This is the follow up from https://lkml.org/lkml/2011/1/17/154
Following patches make jbd2 to use GFP_KERNEL for transaction
allocation if the caller can handle the errors. Following is the list
of functions that I updated to pass the new flag. Also below is the
list of functions which still have the old behavior and pass the old
flags (either because they can't deal with errors, or I wasn't too
sure so I did conservatively). Appreciate your feedback. The other
callers of jbd2_journal_start() are from ocfs2, they still pass the
old flag.

OK to handle errors.
-------------------------
ext4_init_inode_table
ext4_group_add
setup_new_group_blocks
update_backups
ext4_group_extend
ext4_release_dquot
ext4_acquire_dquot
ext4_acl_chmod
ext4_xattr_set_acl
ext4_xattr_set
et4_ioctl - For setting EXT4_IOC_SETVERSION_OLD
ext4_ext_migrate
ext4_ext_migrate
ext4_rmdir
ext4_unlink
ext4_symlink
ext4_link
ext4_rename
ext4_mkdir
ext4_mknod
ext4_fallocate
ext4_create
move_extent_per_page
ext4_change_inode_journal_flag
ext4_setattr
ext4_setattr

NOT ok
-------------------
ext4_write_dquot
ext4_ioctl - Not ok for EXT4_EOFBLOCKS_FL
ext4_ext_remove_space
ext4_ext_truncate
ext4_write_info
ext4_convert_unwritten_extents
ext4_ind_direct_IO
ext4_ind_direct_IO
ext4_dirty_inode
ext4_setattr
ext4_evict_inode
_ext4_get_block
ext4_write_begin
__ext4_journalled_writepage
ext4_da_writepages
ext4_da_write_begin
start_transaction

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 faad2bd..0fa4c86 100644
--- a/fs/jbd2/transaction.c
+++ b/fs/jbd2/transaction.c
@@ -346,9 +346,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);

@@ -476,9 +477,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);

@@ -1429,7 +1431,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 27e79c2..b24342f 100644
--- a/include/linux/jbd2.h
+++ b/include/linux/jbd2.h
@@ -1081,9 +1081,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.6.0.4




-- 
Thanks -
Manish
==================================
[$\*.^ -- I miss being one of them
==================================
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[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