diff options
-rw-r--r-- | fs/gfs2/aops.c | 7 | ||||
-rw-r--r-- | fs/gfs2/bmap.c | 12 | ||||
-rw-r--r-- | fs/gfs2/log.h | 7 | ||||
-rw-r--r-- | fs/gfs2/quota.c | 5 | ||||
-rw-r--r-- | fs/gfs2/trans.c | 27 |
5 files changed, 30 insertions, 28 deletions
diff --git a/fs/gfs2/aops.c b/fs/gfs2/aops.c index 69f25e3c97ce..35f5ee23566d 100644 --- a/fs/gfs2/aops.c +++ b/fs/gfs2/aops.c | |||
@@ -54,8 +54,7 @@ static void gfs2_page_add_databufs(struct gfs2_inode *ip, struct page *page, | |||
54 | continue; | 54 | continue; |
55 | if (start >= to) | 55 | if (start >= to) |
56 | break; | 56 | break; |
57 | if (gfs2_is_jdata(ip)) | 57 | set_buffer_uptodate(bh); |
58 | set_buffer_uptodate(bh); | ||
59 | gfs2_trans_add_data(ip->i_gl, bh); | 58 | gfs2_trans_add_data(ip->i_gl, bh); |
60 | } | 59 | } |
61 | } | 60 | } |
@@ -894,8 +893,10 @@ static int gfs2_write_end(struct file *file, struct address_space *mapping, | |||
894 | goto out2; | 893 | goto out2; |
895 | } | 894 | } |
896 | 895 | ||
897 | if (!gfs2_is_writeback(ip)) | 896 | if (gfs2_is_jdata(ip)) |
898 | gfs2_page_add_databufs(ip, page, pos & ~PAGE_MASK, len); | 897 | gfs2_page_add_databufs(ip, page, pos & ~PAGE_MASK, len); |
898 | else | ||
899 | gfs2_ordered_add_inode(ip); | ||
899 | 900 | ||
900 | ret = generic_write_end(file, mapping, pos, len, copied, page, fsdata); | 901 | ret = generic_write_end(file, mapping, pos, len, copied, page, fsdata); |
901 | page = NULL; | 902 | page = NULL; |
diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c index 69f846418ad5..5226c3bfbcf7 100644 --- a/fs/gfs2/bmap.c +++ b/fs/gfs2/bmap.c | |||
@@ -89,10 +89,12 @@ static int gfs2_unstuffer_page(struct gfs2_inode *ip, struct buffer_head *dibh, | |||
89 | map_bh(bh, inode->i_sb, block); | 89 | map_bh(bh, inode->i_sb, block); |
90 | 90 | ||
91 | set_buffer_uptodate(bh); | 91 | set_buffer_uptodate(bh); |
92 | if (!gfs2_is_jdata(ip)) | 92 | if (gfs2_is_jdata(ip)) |
93 | mark_buffer_dirty(bh); | ||
94 | if (!gfs2_is_writeback(ip)) | ||
95 | gfs2_trans_add_data(ip->i_gl, bh); | 93 | gfs2_trans_add_data(ip->i_gl, bh); |
94 | else { | ||
95 | mark_buffer_dirty(bh); | ||
96 | gfs2_ordered_add_inode(ip); | ||
97 | } | ||
96 | 98 | ||
97 | if (release) { | 99 | if (release) { |
98 | unlock_page(page); | 100 | unlock_page(page); |
@@ -1028,8 +1030,10 @@ static int gfs2_block_zero_range(struct inode *inode, loff_t from, | |||
1028 | err = 0; | 1030 | err = 0; |
1029 | } | 1031 | } |
1030 | 1032 | ||
1031 | if (!gfs2_is_writeback(ip)) | 1033 | if (gfs2_is_jdata(ip)) |
1032 | gfs2_trans_add_data(ip->i_gl, bh); | 1034 | gfs2_trans_add_data(ip->i_gl, bh); |
1035 | else | ||
1036 | gfs2_ordered_add_inode(ip); | ||
1033 | 1037 | ||
1034 | zero_user(page, offset, length); | 1038 | zero_user(page, offset, length); |
1035 | mark_buffer_dirty(bh); | 1039 | mark_buffer_dirty(bh); |
diff --git a/fs/gfs2/log.h b/fs/gfs2/log.h index 1862e310a067..20241436126d 100644 --- a/fs/gfs2/log.h +++ b/fs/gfs2/log.h | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/spinlock.h> | 14 | #include <linux/spinlock.h> |
15 | #include <linux/writeback.h> | 15 | #include <linux/writeback.h> |
16 | #include "incore.h" | 16 | #include "incore.h" |
17 | #include "inode.h" | ||
17 | 18 | ||
18 | /** | 19 | /** |
19 | * gfs2_log_lock - acquire the right to mess with the log manager | 20 | * gfs2_log_lock - acquire the right to mess with the log manager |
@@ -50,8 +51,12 @@ static inline void gfs2_log_pointers_init(struct gfs2_sbd *sdp, | |||
50 | 51 | ||
51 | static inline void gfs2_ordered_add_inode(struct gfs2_inode *ip) | 52 | static inline void gfs2_ordered_add_inode(struct gfs2_inode *ip) |
52 | { | 53 | { |
53 | struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); | 54 | struct gfs2_sbd *sdp; |
54 | 55 | ||
56 | if (!gfs2_is_ordered(ip)) | ||
57 | return; | ||
58 | |||
59 | sdp = GFS2_SB(&ip->i_inode); | ||
55 | if (!test_bit(GIF_ORDERED, &ip->i_flags)) { | 60 | if (!test_bit(GIF_ORDERED, &ip->i_flags)) { |
56 | spin_lock(&sdp->sd_ordered_lock); | 61 | spin_lock(&sdp->sd_ordered_lock); |
57 | if (!test_and_set_bit(GIF_ORDERED, &ip->i_flags)) | 62 | if (!test_and_set_bit(GIF_ORDERED, &ip->i_flags)) |
diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c index 7a98abd340ee..e8585dfd209f 100644 --- a/fs/gfs2/quota.c +++ b/fs/gfs2/quota.c | |||
@@ -735,7 +735,10 @@ static int gfs2_write_buf_to_page(struct gfs2_inode *ip, unsigned long index, | |||
735 | if (!buffer_uptodate(bh)) | 735 | if (!buffer_uptodate(bh)) |
736 | goto unlock_out; | 736 | goto unlock_out; |
737 | } | 737 | } |
738 | gfs2_trans_add_data(ip->i_gl, bh); | 738 | if (gfs2_is_jdata(ip)) |
739 | gfs2_trans_add_data(ip->i_gl, bh); | ||
740 | else | ||
741 | gfs2_ordered_add_inode(ip); | ||
739 | 742 | ||
740 | /* If we need to write to the next block as well */ | 743 | /* If we need to write to the next block as well */ |
741 | if (to_write > (bsize - boff)) { | 744 | if (to_write > (bsize - boff)) { |
diff --git a/fs/gfs2/trans.c b/fs/gfs2/trans.c index c75cacaa349b..064c9a0ef046 100644 --- a/fs/gfs2/trans.c +++ b/fs/gfs2/trans.c | |||
@@ -143,32 +143,21 @@ static struct gfs2_bufdata *gfs2_alloc_bufdata(struct gfs2_glock *gl, | |||
143 | * @gl: The inode glock associated with the buffer | 143 | * @gl: The inode glock associated with the buffer |
144 | * @bh: The buffer to add | 144 | * @bh: The buffer to add |
145 | * | 145 | * |
146 | * This is used in two distinct cases: | 146 | * This is used in journaled data mode. |
147 | * i) In ordered write mode | 147 | * We need to journal the data block in the same way as metadata in |
148 | * We put the data buffer on a list so that we can ensure that it's | 148 | * the functions above. The difference is that here we have a tag |
149 | * synced to disk at the right time | 149 | * which is two __be64's being the block number (as per meta data) |
150 | * ii) In journaled data mode | 150 | * and a flag which says whether the data block needs escaping or |
151 | * We need to journal the data block in the same way as metadata in | 151 | * not. This means we need a new log entry for each 251 or so data |
152 | * the functions above. The difference is that here we have a tag | 152 | * blocks, which isn't an enormous overhead but twice as much as |
153 | * which is two __be64's being the block number (as per meta data) | 153 | * for normal metadata blocks. |
154 | * and a flag which says whether the data block needs escaping or | ||
155 | * not. This means we need a new log entry for each 251 or so data | ||
156 | * blocks, which isn't an enormous overhead but twice as much as | ||
157 | * for normal metadata blocks. | ||
158 | */ | 154 | */ |
159 | void gfs2_trans_add_data(struct gfs2_glock *gl, struct buffer_head *bh) | 155 | void gfs2_trans_add_data(struct gfs2_glock *gl, struct buffer_head *bh) |
160 | { | 156 | { |
161 | struct gfs2_trans *tr = current->journal_info; | 157 | struct gfs2_trans *tr = current->journal_info; |
162 | struct gfs2_sbd *sdp = gl->gl_name.ln_sbd; | 158 | struct gfs2_sbd *sdp = gl->gl_name.ln_sbd; |
163 | struct address_space *mapping = bh->b_page->mapping; | ||
164 | struct gfs2_inode *ip = GFS2_I(mapping->host); | ||
165 | struct gfs2_bufdata *bd; | 159 | struct gfs2_bufdata *bd; |
166 | 160 | ||
167 | if (!gfs2_is_jdata(ip)) { | ||
168 | gfs2_ordered_add_inode(ip); | ||
169 | return; | ||
170 | } | ||
171 | |||
172 | lock_buffer(bh); | 161 | lock_buffer(bh); |
173 | if (buffer_pinned(bh)) { | 162 | if (buffer_pinned(bh)) { |
174 | set_bit(TR_TOUCHED, &tr->tr_flags); | 163 | set_bit(TR_TOUCHED, &tr->tr_flags); |