This patch allows a per-file data=ordered mode similar to the per-file data=journal mode implemented now. This functionality isn't yet exported, but the main use of this code is to allow xattrs to be ordered even if the the file system is mounted with data=writeback. Signed-off-by: Jeff Mahoney <jeffm@xxxxxxxx> -- fs/reiserfs/file.c | 2 +- fs/reiserfs/inode.c | 2 +- fs/reiserfs/xattr.c | 5 +++++ include/linux/reiserfs_fs.h | 8 ++++++++ include/linux/reiserfs_fs_i.h | 3 ++- 5 files changed, 17 insertions(+), 3 deletions(-) --- a/fs/reiserfs/file.c 2007-06-11 14:49:35.000000000 -0400 +++ b/fs/reiserfs/file.c 2007-06-11 14:50:04.000000000 -0400 @@ -804,7 +804,7 @@ int reiserfs_commit_page(struct inode *i /* do data=ordered on any page past the end * of file and any buffer marked BH_New. */ - if (reiserfs_data_ordered(inode->i_sb) && + if (reiserfs_file_data_ordered(inode) && (new || page->index >= i_size_index)) { reiserfs_add_ordered_list(inode, bh); } --- a/fs/reiserfs/inode.c 2007-06-11 14:49:36.000000000 -0400 +++ b/fs/reiserfs/inode.c 2007-06-11 14:50:06.000000000 -0400 @@ -734,7 +734,7 @@ int reiserfs_get_block(struct inode *ino } set_buffer_new(bh_result); if (buffer_dirty(bh_result) - && reiserfs_data_ordered(inode->i_sb)) + && reiserfs_file_data_ordered(inode)) reiserfs_add_ordered_list(inode, bh_result); put_block_num(item, pos_in_item, allocated_block_nr); unfm_ptr = allocated_block_nr; --- a/fs/reiserfs/xattr.c 2007-06-11 14:49:37.000000000 -0400 +++ b/fs/reiserfs/xattr.c 2007-06-11 14:50:06.000000000 -0400 @@ -462,6 +462,11 @@ reiserfs_xattr_set(struct inode *inode, goto out_filp; mapping = xinode->i_mapping; + + /* If we're in writeback mode, we still need to order xattr writes */ + if (reiserfs_data_writeback(xinode->i_sb)) + REISERFS_I(xinode)->i_flags |= i_data_ordered; + while (buffer_pos < buffer_size || buffer_pos == 0) { size_t chunk; size_t skip = 0; --- a/include/linux/reiserfs_fs.h 2007-06-11 14:49:36.000000000 -0400 +++ b/include/linux/reiserfs_fs.h 2007-06-11 14:50:06.000000000 -0400 @@ -1699,6 +1699,14 @@ static inline int reiserfs_file_data_log return 0; } +static inline int reiserfs_file_data_ordered(struct inode *inode) +{ + if (reiserfs_data_ordered(inode->i_sb) || + (REISERFS_I(inode)->i_flags & i_data_ordered)) + return 1; + return 0; +} + static inline int reiserfs_transaction_running(struct super_block *s) { struct reiserfs_transaction_handle *th = current->journal_info; --- a/include/linux/reiserfs_fs_i.h 2007-06-11 14:49:36.000000000 -0400 +++ b/include/linux/reiserfs_fs_i.h 2007-06-11 14:49:38.000000000 -0400 @@ -25,7 +25,8 @@ typedef enum { i_link_saved_truncate_mask = 0x0020, i_has_xattr_dir = 0x0040, i_data_log = 0x0080, - i_ever_mapped = 0x0100 + i_ever_mapped = 0x0100, + i_data_ordered = 0x0200, } reiserfs_inode_flags; struct reiserfs_inode_info { -- Jeff Mahoney SUSE Labs - To unsubscribe from this list: send the line "unsubscribe reiserfs-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html