XFS updates the ondisk inode size only after the data I/O has finished,
so it needs a hook when the writepage end_bio handler has finished.

Might not be worth applying as-is as the per-page callback is very
ineffcient.  What XFS really wants is a callback when writeout of a
whole extent has completed.  This delayed i_size updates scheme might
be worthwile for btrfs aswell, btw.


Signed-off-by: Christoph Hellwig <[EMAIL PROTECTED]>

Index: btrfs-9cb5f0f5c713/extent_map.c
===================================================================
--- btrfs-9cb5f0f5c713.orig/extent_map.c        2007-09-02 02:25:47.000000000 
+0200
+++ btrfs-9cb5f0f5c713/extent_map.c     2007-09-02 02:27:38.000000000 +0200
@@ -1227,6 +1227,8 @@ static int end_bio_extent_writepage(stru
                        end_page_writeback(page);
                else
                        check_page_writeback(tree, page);
+               if (tree->ops && tree->ops->writepage_end_io_hook)
+                       tree->ops->writepage_end_io_hook(page, start, end);
        } while (bvec >= bio->bi_io_vec);
 
        bio_put(bio);
Index: btrfs-9cb5f0f5c713/extent_map.h
===================================================================
--- btrfs-9cb5f0f5c713.orig/extent_map.h        2007-09-02 02:25:47.000000000 
+0200
+++ btrfs-9cb5f0f5c713/extent_map.h     2007-09-02 02:49:29.000000000 +0200
@@ -11,6 +11,7 @@ struct extent_map_ops {
        int (*writepage_io_hook)(struct page *page, u64 start, u64 end);
        int (*readpage_io_hook)(struct page *page, u64 start, u64 end);
        int (*readpage_end_io_hook)(struct page *page, u64 start, u64 end);
+       void (*writepage_end_io_hook)(struct page *page, u64 start, u64 end);
 };
 
 struct extent_map_tree {

_______________________________________________
Btrfs-devel mailing list
[email protected]
http://oss.oracle.com/mailman/listinfo/btrfs-devel

Reply via email to