Skip to contentSkip to conversation

GFS2: flush log and pages for jdata in gfs2_write_inode

PATCH New Bob Peterson 2 participants 2 messages Oct 6, 2017 – Oct 16, 2017 1 message not in the archive GFS2 file system

lore
Share & tools
lore
#1 lore raw

PATCH 1/1 GFS2: flush log and pages for jdata in gfs2_write_inode

In reply to a message not in the archive

Hi,

In function gfs2_write_inode, starting with patch a9185b41a4f84, we only flush the log and call filemap_fdatawait if we're passed in a wbc sync_mode of WB_SYNC_ALL. We also need to do these things if we're evicting a jdata inode, because we might have jdata pages still attached to bufdata descriptors that need to be revoked, but by the time it gets to evict() it's too late to start a new transaction. This patch changes it to treat jdata inodes as if WB_SYNC_ALL had been specified.

---

fs/gfs2/super.c +3 -2
index 769841185ce5..ac78e72de790 100644
@@ -754,14 +754,15 @@ static int gfs2_write_inode(struct inode *inode, struct writeback_control *wbc)
 	struct address_space *metamapping = gfs2_glock2aspace(ip->i_gl);
 	struct backing_dev_info *bdi = inode_to_bdi(metamapping->host);
 	int ret = 0;
+	bool flush_all = (wbc->sync_mode == WB_SYNC_ALL || gfs2_is_jdata(ip));
 
-	if (wbc->sync_mode == WB_SYNC_ALL)
+	if (flush_all)
 		gfs2_log_flush(GFS2_SB(inode), ip->i_gl, NORMAL_FLUSH);
 	if (bdi->wb.dirty_exceeded)
 		gfs2_ail1_flush(sdp, wbc);
 	else
 		filemap_fdatawrite(metamapping);
-	if (wbc->sync_mode == WB_SYNC_ALL)
+	if (flush_all)
 		ret = filemap_fdatawait(metamapping);
 	if (ret)
 		mark_inode_dirty_sync(inode);
#2 lore raw

PATCH 1/1 GFS2: flush log and pages for jdata in gfs2_write_inode

Hi,

Looks good to me. ACK.

Cheers!
--Abhi

----- Original Message -----

Quoted 43 lines

From: "Bob Peterson" <[email protected]>
To: "cluster-devel" <[email protected]>
Sent: Friday, October 6, 2017 8:38:21 AM
Subject: [Cluster-devel] [GFS2 PATCH] GFS2: flush log and pages for jdata in gfs2_write_inode

Hi,

In function gfs2_write_inode, starting with patch a9185b41a4f84, we only flush the log and call filemap_fdatawait if we're passed in a wbc sync_mode of WB_SYNC_ALL. We also need to do these things if we're evicting a jdata inode, because we might have jdata pages still attached to bufdata descriptors that need to be revoked, but by the time it gets to evict() it's too late to start a new transaction. This patch changes it to treat jdata inodes as if WB_SYNC_ALL had been specified.

---

fs/gfs2/super.c +3 -2
index 769841185ce5..ac78e72de790 100644
@@ -754,14 +754,15 @@ static int gfs2_write_inode(struct inode *inode, struct
 writeback_control *wbc)
 	struct address_space *metamapping = gfs2_glock2aspace(ip->i_gl);
 	struct backing_dev_info *bdi = inode_to_bdi(metamapping->host);
 	int ret = 0;
+	bool flush_all = (wbc->sync_mode == WB_SYNC_ALL || gfs2_is_jdata(ip));
 
-	if (wbc->sync_mode == WB_SYNC_ALL)
+	if (flush_all)
 		gfs2_log_flush(GFS2_SB(inode), ip->i_gl, NORMAL_FLUSH);
 	if (bdi->wb.dirty_exceeded)
 		gfs2_ail1_flush(sdp, wbc);
 	else
 		filemap_fdatawrite(metamapping);
-	if (wbc->sync_mode == WB_SYNC_ALL)
+	if (flush_all)
 		ret = filemap_fdatawait(metamapping);
 	if (ret)

mark_inode_dirty_sync(inode);