diff options
Diffstat (limited to 'fs/xfs/libxfs/xfs_rmap.c')
-rw-r--r-- | fs/xfs/libxfs/xfs_rmap.c | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/fs/xfs/libxfs/xfs_rmap.c b/fs/xfs/libxfs/xfs_rmap.c index 0769aca4192b..28c87ead80ba 100644 --- a/fs/xfs/libxfs/xfs_rmap.c +++ b/fs/xfs/libxfs/xfs_rmap.c | |||
@@ -2268,7 +2268,7 @@ xfs_rmap_update_is_needed( | |||
2268 | * Record a rmap intent; the list is kept sorted first by AG and then by | 2268 | * Record a rmap intent; the list is kept sorted first by AG and then by |
2269 | * increasing age. | 2269 | * increasing age. |
2270 | */ | 2270 | */ |
2271 | static int | 2271 | static void |
2272 | __xfs_rmap_add( | 2272 | __xfs_rmap_add( |
2273 | struct xfs_trans *tp, | 2273 | struct xfs_trans *tp, |
2274 | enum xfs_rmap_intent_type type, | 2274 | enum xfs_rmap_intent_type type, |
@@ -2295,11 +2295,10 @@ __xfs_rmap_add( | |||
2295 | ri->ri_bmap = *bmap; | 2295 | ri->ri_bmap = *bmap; |
2296 | 2296 | ||
2297 | xfs_defer_add(tp, XFS_DEFER_OPS_TYPE_RMAP, &ri->ri_list); | 2297 | xfs_defer_add(tp, XFS_DEFER_OPS_TYPE_RMAP, &ri->ri_list); |
2298 | return 0; | ||
2299 | } | 2298 | } |
2300 | 2299 | ||
2301 | /* Map an extent into a file. */ | 2300 | /* Map an extent into a file. */ |
2302 | int | 2301 | void |
2303 | xfs_rmap_map_extent( | 2302 | xfs_rmap_map_extent( |
2304 | struct xfs_trans *tp, | 2303 | struct xfs_trans *tp, |
2305 | struct xfs_inode *ip, | 2304 | struct xfs_inode *ip, |
@@ -2307,15 +2306,15 @@ xfs_rmap_map_extent( | |||
2307 | struct xfs_bmbt_irec *PREV) | 2306 | struct xfs_bmbt_irec *PREV) |
2308 | { | 2307 | { |
2309 | if (!xfs_rmap_update_is_needed(tp->t_mountp, whichfork)) | 2308 | if (!xfs_rmap_update_is_needed(tp->t_mountp, whichfork)) |
2310 | return 0; | 2309 | return; |
2311 | 2310 | ||
2312 | return __xfs_rmap_add(tp, xfs_is_reflink_inode(ip) ? | 2311 | __xfs_rmap_add(tp, xfs_is_reflink_inode(ip) ? |
2313 | XFS_RMAP_MAP_SHARED : XFS_RMAP_MAP, ip->i_ino, | 2312 | XFS_RMAP_MAP_SHARED : XFS_RMAP_MAP, ip->i_ino, |
2314 | whichfork, PREV); | 2313 | whichfork, PREV); |
2315 | } | 2314 | } |
2316 | 2315 | ||
2317 | /* Unmap an extent out of a file. */ | 2316 | /* Unmap an extent out of a file. */ |
2318 | int | 2317 | void |
2319 | xfs_rmap_unmap_extent( | 2318 | xfs_rmap_unmap_extent( |
2320 | struct xfs_trans *tp, | 2319 | struct xfs_trans *tp, |
2321 | struct xfs_inode *ip, | 2320 | struct xfs_inode *ip, |
@@ -2323,9 +2322,9 @@ xfs_rmap_unmap_extent( | |||
2323 | struct xfs_bmbt_irec *PREV) | 2322 | struct xfs_bmbt_irec *PREV) |
2324 | { | 2323 | { |
2325 | if (!xfs_rmap_update_is_needed(tp->t_mountp, whichfork)) | 2324 | if (!xfs_rmap_update_is_needed(tp->t_mountp, whichfork)) |
2326 | return 0; | 2325 | return; |
2327 | 2326 | ||
2328 | return __xfs_rmap_add(tp, xfs_is_reflink_inode(ip) ? | 2327 | __xfs_rmap_add(tp, xfs_is_reflink_inode(ip) ? |
2329 | XFS_RMAP_UNMAP_SHARED : XFS_RMAP_UNMAP, ip->i_ino, | 2328 | XFS_RMAP_UNMAP_SHARED : XFS_RMAP_UNMAP, ip->i_ino, |
2330 | whichfork, PREV); | 2329 | whichfork, PREV); |
2331 | } | 2330 | } |
@@ -2336,7 +2335,7 @@ xfs_rmap_unmap_extent( | |||
2336 | * Note that tp can be NULL here as no transaction is used for COW fork | 2335 | * Note that tp can be NULL here as no transaction is used for COW fork |
2337 | * unwritten conversion. | 2336 | * unwritten conversion. |
2338 | */ | 2337 | */ |
2339 | int | 2338 | void |
2340 | xfs_rmap_convert_extent( | 2339 | xfs_rmap_convert_extent( |
2341 | struct xfs_mount *mp, | 2340 | struct xfs_mount *mp, |
2342 | struct xfs_trans *tp, | 2341 | struct xfs_trans *tp, |
@@ -2345,15 +2344,15 @@ xfs_rmap_convert_extent( | |||
2345 | struct xfs_bmbt_irec *PREV) | 2344 | struct xfs_bmbt_irec *PREV) |
2346 | { | 2345 | { |
2347 | if (!xfs_rmap_update_is_needed(mp, whichfork)) | 2346 | if (!xfs_rmap_update_is_needed(mp, whichfork)) |
2348 | return 0; | 2347 | return; |
2349 | 2348 | ||
2350 | return __xfs_rmap_add(tp, xfs_is_reflink_inode(ip) ? | 2349 | __xfs_rmap_add(tp, xfs_is_reflink_inode(ip) ? |
2351 | XFS_RMAP_CONVERT_SHARED : XFS_RMAP_CONVERT, ip->i_ino, | 2350 | XFS_RMAP_CONVERT_SHARED : XFS_RMAP_CONVERT, ip->i_ino, |
2352 | whichfork, PREV); | 2351 | whichfork, PREV); |
2353 | } | 2352 | } |
2354 | 2353 | ||
2355 | /* Schedule the creation of an rmap for non-file data. */ | 2354 | /* Schedule the creation of an rmap for non-file data. */ |
2356 | int | 2355 | void |
2357 | xfs_rmap_alloc_extent( | 2356 | xfs_rmap_alloc_extent( |
2358 | struct xfs_trans *tp, | 2357 | struct xfs_trans *tp, |
2359 | xfs_agnumber_t agno, | 2358 | xfs_agnumber_t agno, |
@@ -2364,18 +2363,18 @@ xfs_rmap_alloc_extent( | |||
2364 | struct xfs_bmbt_irec bmap; | 2363 | struct xfs_bmbt_irec bmap; |
2365 | 2364 | ||
2366 | if (!xfs_rmap_update_is_needed(tp->t_mountp, XFS_DATA_FORK)) | 2365 | if (!xfs_rmap_update_is_needed(tp->t_mountp, XFS_DATA_FORK)) |
2367 | return 0; | 2366 | return; |
2368 | 2367 | ||
2369 | bmap.br_startblock = XFS_AGB_TO_FSB(tp->t_mountp, agno, bno); | 2368 | bmap.br_startblock = XFS_AGB_TO_FSB(tp->t_mountp, agno, bno); |
2370 | bmap.br_blockcount = len; | 2369 | bmap.br_blockcount = len; |
2371 | bmap.br_startoff = 0; | 2370 | bmap.br_startoff = 0; |
2372 | bmap.br_state = XFS_EXT_NORM; | 2371 | bmap.br_state = XFS_EXT_NORM; |
2373 | 2372 | ||
2374 | return __xfs_rmap_add(tp, XFS_RMAP_ALLOC, owner, XFS_DATA_FORK, &bmap); | 2373 | __xfs_rmap_add(tp, XFS_RMAP_ALLOC, owner, XFS_DATA_FORK, &bmap); |
2375 | } | 2374 | } |
2376 | 2375 | ||
2377 | /* Schedule the deletion of an rmap for non-file data. */ | 2376 | /* Schedule the deletion of an rmap for non-file data. */ |
2378 | int | 2377 | void |
2379 | xfs_rmap_free_extent( | 2378 | xfs_rmap_free_extent( |
2380 | struct xfs_trans *tp, | 2379 | struct xfs_trans *tp, |
2381 | xfs_agnumber_t agno, | 2380 | xfs_agnumber_t agno, |
@@ -2386,14 +2385,14 @@ xfs_rmap_free_extent( | |||
2386 | struct xfs_bmbt_irec bmap; | 2385 | struct xfs_bmbt_irec bmap; |
2387 | 2386 | ||
2388 | if (!xfs_rmap_update_is_needed(tp->t_mountp, XFS_DATA_FORK)) | 2387 | if (!xfs_rmap_update_is_needed(tp->t_mountp, XFS_DATA_FORK)) |
2389 | return 0; | 2388 | return; |
2390 | 2389 | ||
2391 | bmap.br_startblock = XFS_AGB_TO_FSB(tp->t_mountp, agno, bno); | 2390 | bmap.br_startblock = XFS_AGB_TO_FSB(tp->t_mountp, agno, bno); |
2392 | bmap.br_blockcount = len; | 2391 | bmap.br_blockcount = len; |
2393 | bmap.br_startoff = 0; | 2392 | bmap.br_startoff = 0; |
2394 | bmap.br_state = XFS_EXT_NORM; | 2393 | bmap.br_state = XFS_EXT_NORM; |
2395 | 2394 | ||
2396 | return __xfs_rmap_add(tp, XFS_RMAP_FREE, owner, XFS_DATA_FORK, &bmap); | 2395 | __xfs_rmap_add(tp, XFS_RMAP_FREE, owner, XFS_DATA_FORK, &bmap); |
2397 | } | 2396 | } |
2398 | 2397 | ||
2399 | /* Compare rmap records. Returns -1 if a < b, 1 if a > b, and 0 if equal. */ | 2398 | /* Compare rmap records. Returns -1 if a < b, 1 if a > b, and 0 if equal. */ |