diff options
Diffstat (limited to 'fs/btrfs/extent_io.c')
-rw-r--r-- | fs/btrfs/extent_io.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index f173c5af6461..cdee391fc7bf 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c | |||
@@ -1257,6 +1257,39 @@ int unlock_extent(struct extent_io_tree *tree, u64 start, u64 end) | |||
1257 | GFP_NOFS); | 1257 | GFP_NOFS); |
1258 | } | 1258 | } |
1259 | 1259 | ||
1260 | int extent_range_clear_dirty_for_io(struct inode *inode, u64 start, u64 end) | ||
1261 | { | ||
1262 | unsigned long index = start >> PAGE_CACHE_SHIFT; | ||
1263 | unsigned long end_index = end >> PAGE_CACHE_SHIFT; | ||
1264 | struct page *page; | ||
1265 | |||
1266 | while (index <= end_index) { | ||
1267 | page = find_get_page(inode->i_mapping, index); | ||
1268 | BUG_ON(!page); /* Pages should be in the extent_io_tree */ | ||
1269 | clear_page_dirty_for_io(page); | ||
1270 | page_cache_release(page); | ||
1271 | index++; | ||
1272 | } | ||
1273 | return 0; | ||
1274 | } | ||
1275 | |||
1276 | int extent_range_redirty_for_io(struct inode *inode, u64 start, u64 end) | ||
1277 | { | ||
1278 | unsigned long index = start >> PAGE_CACHE_SHIFT; | ||
1279 | unsigned long end_index = end >> PAGE_CACHE_SHIFT; | ||
1280 | struct page *page; | ||
1281 | |||
1282 | while (index <= end_index) { | ||
1283 | page = find_get_page(inode->i_mapping, index); | ||
1284 | BUG_ON(!page); /* Pages should be in the extent_io_tree */ | ||
1285 | account_page_redirty(page); | ||
1286 | __set_page_dirty_nobuffers(page); | ||
1287 | page_cache_release(page); | ||
1288 | index++; | ||
1289 | } | ||
1290 | return 0; | ||
1291 | } | ||
1292 | |||
1260 | /* | 1293 | /* |
1261 | * helper function to set both pages and extents in the tree writeback | 1294 | * helper function to set both pages and extents in the tree writeback |
1262 | */ | 1295 | */ |