aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/trans.c
diff options
context:
space:
mode:
authorAndreas Gruenbacher <agruenba@redhat.com>2018-06-04 08:50:16 -0400
committerBob Peterson <rpeterso@redhat.com>2018-06-04 08:50:16 -0400
commit845802b112eeedfa32b2ebba694996a49677596e (patch)
treee0f4d8f2ad943c67d9e050845cc8c198018f765d /fs/gfs2/trans.c
parentd6382a3505d289ec2df55a822f1fd72d9a72d256 (diff)
gfs2: Remove ordered write mode handling from gfs2_trans_add_data
In journaled data mode, we need to add each buffer head to the current transaction. In ordered write mode, we only need to add the inode to the ordered inode list. So far, both cases are handled in gfs2_trans_add_data. This makes the code look misleading and is inefficient for small block sizes as well. Handle both cases separately instead. Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com> Signed-off-by: Bob Peterson <rpeterso@redhat.com>
Diffstat (limited to 'fs/gfs2/trans.c')
-rw-r--r--fs/gfs2/trans.c27
1 files changed, 8 insertions, 19 deletions
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 */
159void gfs2_trans_add_data(struct gfs2_glock *gl, struct buffer_head *bh) 155void 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);