| @@ -887,12 +887,19 @@ __iomap_read_page(struct inode *inode, loff_t offset) · 886 unmodified lines |
| 887 | 887 | } |
| 888 | 888 | |
| 889 | 889 | static loff_t |
| 890 | | −iomap_dirty_actor(struct inode *inode, loff_t pos, loff_t length, void *data, |
| 890 | +iomap_unshare_actor(struct inode *inode, loff_t pos, loff_t length, void *data, |
| 891 | 891 | struct iomap *iomap) |
| 892 | 892 | { |
| 893 | 893 | long status = 0; |
| 894 | 894 | ssize_t written = 0; |
| 895 | 895 | |
| 896 | + /* don't bother with blocks that are not shared to start with */ |
| 897 | + if (!(iomap->flags & IOMAP_F_SHARED)) |
| 898 | + return length; |
| 899 | + /* don't bother with holes or unwritten extents */ |
| 900 | + if (iomap->type == IOMAP_HOLE || iomap->type == IOMAP_UNWRITTEN) |
| 901 | + return length; |
| 902 | + |
| 896 | 903 | do { |
| 897 | 904 | struct page *page, *rpage; |
| 898 | 905 | unsigned long offset; /* Offset into pagecache page */ |
| @@ -932,14 +939,14 @@ iomap_dirty_actor(struct inode *inode, loff_t pos, loff_t length, void *data, · 33 unmodified lines |
| 932 | 939 | } |
| 933 | 940 | |
| 934 | 941 | int |
| 935 | | −iomap_file_dirty(struct inode *inode, loff_t pos, loff_t len, |
| 942 | +iomap_file_unshare(struct inode *inode, loff_t pos, loff_t len, |
| 936 | 943 | const struct iomap_ops *ops) |
| 937 | 944 | { |
| 938 | 945 | loff_t ret; |
| 939 | 946 | |
| 940 | 947 | while (len) { |
| 941 | 948 | ret = iomap_apply(inode, pos, len, IOMAP_WRITE, ops, NULL, |
| 942 | | − iomap_dirty_actor); |
| 949 | + iomap_unshare_actor); |
| 943 | 950 | if (ret <= 0) |
| 944 | 951 | return ret; |
| 945 | 952 | pos += ret; |
| @@ -948,7 +955,7 @@ iomap_file_dirty(struct inode *inode, loff_t pos, loff_t len, · 2 unmodified lines |
| 948 | 955 | |
| 949 | 956 | return 0; |
| 950 | 957 | } |
| 951 | | −EXPORT_SYMBOL_GPL(iomap_file_dirty); |
| 958 | +EXPORT_SYMBOL_GPL(iomap_file_unshare); |
| 952 | 959 | |
| 953 | 960 | static int iomap_zero(struct inode *inode, loff_t pos, unsigned offset, |
| 954 | 961 | unsigned bytes, struct iomap *iomap) |