Hi Bob,

On 14 May 2018 at 16:18, Bob Peterson <rpete...@redhat.com> wrote:
> Before this patch, the ordered_write function would submit all
> the ordered writes with filemap_fdatawrite, which waited for each
> one to complete before moving on to the next. This patch allows it
> to submit them all, then wait for them after they're submitted.

this looks reasonable.  I think it's not very helpful to reuse
gfs2_ordered_wait here though: the folowing incremental patch should
work just as well or better.

Andreas

---
 fs/gfs2/log.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c
index b05d0fbc3d05..2a9b1c008325 100644
--- a/fs/gfs2/log.c
+++ b/fs/gfs2/log.c
@@ -577,12 +577,15 @@ static void gfs2_ordered_write(struct gfs2_sbd *sdp)
                        continue;
                }
                list_move_tail(&ip->i_ordered, &written);
-               spin_unlock(&sdp->sd_ordered_lock);
-               mapping->a_ops->writepages(mapping, &wbc);
-               spin_lock(&sdp->sd_ordered_lock);
        }
        spin_unlock(&sdp->sd_ordered_lock);
-       gfs2_ordered_wait(sdp, &written, &sdp->sd_log_le_ordered);
+       list_for_each_entry(ip, &written, i_ordered)
+               mapping->a_ops->writepages(ip->i_inode.i_mapping, &wbc);
+       list_for_each_entry(ip, &written, i_ordered)
+               filemap_fdatawait(ip->i_inode.i_mapping);
+       spin_lock(&sdp->sd_ordered_lock);
+       list_splice_tail(&written, &sdp->sd_log_le_ordered);
+       spin_unlock(&sdp->sd_ordered_lock);
 }
 
 void gfs2_ordered_del_inode(struct gfs2_inode *ip)
-- 
2.17.0

Reply via email to