reiserfs data logging support
PATCH 1/1 reiserfs data logging support
Add data=journal support for reiserfs
fs/reiserfs/file.c +18 -2
@@ -591,9 +591,19 @@ int reiserfs_commit_page(struct inode *istruct buffer_head *bh, *head;unsigned long i_size_index = inode->i_size >>PAGE_CACHE_SHIFT ;int new; +int logit =reiserfs_file_data_log (inode); +struct super_block *s = inode->i_sb; +int bh_per_page =PAGE_CACHE_SIZE / s->s_blocksize; +struct reiserfs_transaction_handle th; + th.t_trans_id =0 ; blocksize =1 << inode->i_blkbits; +if (logit) { +reiserfs_write_lock (s); +journal_begin (&th, s, bh_per_page +1 ); +reiserfs_update_inode_transaction (inode); + }for (bh = head =page_buffers (page), block_start =0 ; bh != head || !block_start; block_start=block_end, bh = bh->b_this_page)
@@ -607,7 +617,10 @@ int reiserfs_commit_page(struct inode *i partial =1 ; }else {set_buffer_uptodate (bh); -if (!buffer_dirty (bh)) { +if (logit) { +reiserfs_prepare_for_journal (s, bh,1 ); +journal_mark_dirty (&th, s, bh); + }else if (!buffer_dirty (bh)) {mark_buffer_dirty (bh);/* do data=ordered on any page past the end * of file and any buffer marked BH_New.
@@ -619,7 +632,10 @@ int reiserfs_commit_page(struct inode *i } } } - +if (logit) { +journal_end (&th, s, bh_per_page +1 ); +reiserfs_write_unlock (s); + }/* * If this is a partial write which happened to make all buffers * uptodate then we can optimize away a bogus readpage() for
fs/reiserfs/inode.c +49 -10
130 lines not on this page · raw message
fs/reiserfs/journal.c +12 -4
@@ -1024,7 +1024,6 @@ static int flush_commit_list(struct supeup (&jl->j_commit_lock); put_jl:put_journal_list (s, jl); -return 0 ; }
@@ -1544,14 +1543,18 @@ static int flush_used_journal_lists(struunsigned long cur_len;int ret;int i; +int limit =256 ;struct reiserfs_journal_list *tjl;struct reiserfs_journal_list *flush_jl;unsigned long trans_id; flush_jl = tjl = jl; -/* flush for 256 transactions or 256 blocks, whichever comes first */ -for (i =0 ; i <256 && len <256 ; i++) { +/* in data logging mode, try harder to flush a lot of blocks */ +if (reiserfs_data_log (s)) + limit =1024 ; +/* flush for 256 transactions or limit blocks, whichever comes first */ +for (i =0 ; i <256 && len < limit ; i++) {if (atomic_read (&tjl->j_commit_left) || tjl->j_trans_id < jl->j_trans_id) {break ;
@@ -3480,10 +3483,15 @@ static int do_journal_end(struct reiserf/* copy all the real blocks into log area. dirty log blocks */ if (test_bit (BH_JDirty, &cn->bh->b_state)) {struct buffer_head *tmp_bh ; +char *addr; +struct page *page; tmp_bh =journal_getblk (p_s_sb,SB_ONDISK_JOURNAL_1st_BLOCK (p_s_sb) + ((cur_write_start + jindex) %SB_ONDISK_JOURNAL_SIZE (p_s_sb))) ;set_buffer_uptodate (tmp_bh); -memcpy (tmp_bh->b_data, cn->bh->b_data, cn->bh->b_size) ; + page = cn->bh->b_page; + addr =kmap (page); +memcpy (tmp_bh->b_data, addr, cn->bh->b_size) ; +kunmap (page);mark_buffer_dirty (tmp_bh); jindex++ ;set_bit (BH_JDirty_wait, &(cn->bh->b_state)) ;
fs/reiserfs/stree.c +40 -3
68 lines not on this page · raw message
fs/reiserfs/tail_conversion.c +0 -41
53 lines not on this page · raw message
include/linux/reiserfs_fs.h +8 -0
@@ -1752,6 +1752,14 @@ int reiserfs_add_tail_list(struct inodeint reiserfs_add_ordered_list (struct inode *inode,struct buffer_head *bh);int journal_mark_dirty (struct reiserfs_transaction_handle *,struct super_block *,struct buffer_head *bh) ; +static inline int +reiserfs_file_data_log (struct inode *inode) { +if (reiserfs_data_log (inode->i_sb) || + (REISERFS_I (inode)->i_flags & i_data_log)) +return 1 ; +return 0 ; +} +static inline int reiserfs_transaction_running (struct super_block *s) {struct reiserfs_transaction_handle *th = current->journal_info ;if (th && th->t_super == s)
include/linux/reiserfs_fs_i.h +1 -0
@@ -25,6 +25,7 @@ typedef enum { i_link_saved_truncate_mask =0x0020 , i_priv_object =0x0080 , i_has_xattr_dir =0x0100 , + i_data_log =0x0200 , } reiserfs_inode_flags;