Skip to contentSkip to conversation

gfs2: Trim the ordered write list in gfs2_ordered_write()

PATCH New Abhi Das 3 participants 3 messages Dec 21, 2017 – Dec 22, 2017 GFS2 file system

lore
Share & tools
lore

Abhi Das

author
#0 lore raw

PATCH 1/1 gfs2: Trim the ordered write list in gfs2_ordered_write()

We iterate through the entire ordered writes list in gfs2_ordered_write() to write out inodes. It's a good place to try and shrink the list by throwing out inodes that don't have any pages.

---
 fs/gfs2/log.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
fs/gfs2/log.c +5 -2
index f72c442..ab18d2c 100644
@@ -538,9 +538,12 @@ static void gfs2_ordered_write(struct gfs2_sbd *sdp)
 	list_sort(NULL, &sdp->sd_log_le_ordered, &ip_cmp);
 	while (!list_empty(&sdp->sd_log_le_ordered)) {
 		ip = list_entry(sdp->sd_log_le_ordered.next, struct gfs2_inode, i_ordered);
-		list_move(&ip->i_ordered, &written);
-		if (ip->i_inode.i_mapping->nrpages == 0)
+		if (ip->i_inode.i_mapping->nrpages == 0) {
+			test_and_clear_bit(GIF_ORDERED, &ip->i_flags);
+			list_del(&ip->i_ordered);
 			continue;
+		}
+		list_move(&ip->i_ordered, &written);
 		spin_unlock(&sdp->sd_ordered_lock);
 		filemap_fdatawrite(ip->i_inode.i_mapping);
 		spin_lock(&sdp->sd_ordered_lock);
Signature · 1 line
2.4.11
#1 lore raw

PATCH 1/1 gfs2: Trim the ordered write list in gfs2_ordered_write()

Hi,

This looks good...

Steve.

Quoted 29 lines · Abhi Das

We iterate through the entire ordered writes list in gfs2_ordered_write() to write out inodes. It's a good place to try and shrink the list by throwing out inodes that don't have any pages.

---
  fs/gfs2/log.c | 7 +++++--
  1 file changed, 5 insertions(+), 2 deletions(-)
fs/gfs2/log.c +5 -2
index f72c442..ab18d2c 100644
@@ -538,9 +538,12 @@ static void gfs2_ordered_write(struct gfs2_sbd *sdp)
  	list_sort(NULL, &sdp->sd_log_le_ordered, &ip_cmp);
  	while (!list_empty(&sdp->sd_log_le_ordered)) {
  		ip = list_entry(sdp->sd_log_le_ordered.next, struct gfs2_inode, i_ordered);
-		list_move(&ip->i_ordered, &written);
-		if (ip->i_inode.i_mapping->nrpages == 0)
+		if (ip->i_inode.i_mapping->nrpages == 0) {
+			test_and_clear_bit(GIF_ORDERED, &ip->i_flags);
+			list_del(&ip->i_ordered);
  			continue;
+		}
+		list_move(&ip->i_ordered, &written);
  		spin_unlock(&sdp->sd_ordered_lock);
  		filemap_fdatawrite(ip->i_inode.i_mapping);
  		spin_lock(&sdp->sd_ordered_lock);
#2 lore raw

PATCH 1/1 gfs2: Trim the ordered write list in gfs2_ordered_write()

In reply to Abhi Das

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

| We iterate through the entire ordered writes list in
| gfs2_ordered_write() to write out inodes. It's a good
| place to try and shrink the list by throwing out inodes
| that don't have any pages.
| 
| Signed-off-by: Abhi Das <[email protected]>
| ---

Hi,

Thanks. This is now pushed to the for-next branch of the linux-gfs2 tree:
https://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2.git/commit/fs/gfs2?h=for-next&id=1f23bc7869fffec40b8bd9333a74a18d1de54d98

Regards,

Bob Peterson
Red Hat File Systems