xfs_rmap.c (ffb5696f7555e44c04b7c1212fcd83ddedc43498) xfs_rmap.c (e7ee96dfb8c2687a29d2c5c3b06c967fa54b839c)
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Copyright (c) 2014 Red Hat, Inc.
4 * All Rights Reserved.
5 */
6#include "xfs.h"
7#include "xfs_fs.h"
8#include "xfs_shared.h"

--- 247 unchanged lines hidden (view full) ---

256 return XFS_BTREE_QUERY_RANGE_CONTINUE;
257 if (!XFS_RMAP_NON_INODE_OWNER(rec->rm_owner) &&
258 !(rec->rm_flags & XFS_RMAP_BMBT_BLOCK) &&
259 rec->rm_offset + rec->rm_blockcount - 1 != info->high.rm_offset)
260 return XFS_BTREE_QUERY_RANGE_CONTINUE;
261
262 *info->irec = *rec;
263 *info->stat = 1;
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Copyright (c) 2014 Red Hat, Inc.
4 * All Rights Reserved.
5 */
6#include "xfs.h"
7#include "xfs_fs.h"
8#include "xfs_shared.h"

--- 247 unchanged lines hidden (view full) ---

256 return XFS_BTREE_QUERY_RANGE_CONTINUE;
257 if (!XFS_RMAP_NON_INODE_OWNER(rec->rm_owner) &&
258 !(rec->rm_flags & XFS_RMAP_BMBT_BLOCK) &&
259 rec->rm_offset + rec->rm_blockcount - 1 != info->high.rm_offset)
260 return XFS_BTREE_QUERY_RANGE_CONTINUE;
261
262 *info->irec = *rec;
263 *info->stat = 1;
264 return XFS_BTREE_QUERY_RANGE_ABORT;
264 return -ECANCELED;
265}
266
267/*
268 * Find the record to the left of the given extent, being careful only to
269 * return a match with the same owner and adjacent physical and logical
270 * block ranges.
271 */
272int

--- 26 unchanged lines hidden (view full) ---

299 info.irec = irec;
300 info.stat = stat;
301
302 trace_xfs_rmap_find_left_neighbor_query(cur->bc_mp,
303 cur->bc_private.a.agno, bno, 0, owner, offset, flags);
304
305 error = xfs_rmap_query_range(cur, &info.high, &info.high,
306 xfs_rmap_find_left_neighbor_helper, &info);
265}
266
267/*
268 * Find the record to the left of the given extent, being careful only to
269 * return a match with the same owner and adjacent physical and logical
270 * block ranges.
271 */
272int

--- 26 unchanged lines hidden (view full) ---

299 info.irec = irec;
300 info.stat = stat;
301
302 trace_xfs_rmap_find_left_neighbor_query(cur->bc_mp,
303 cur->bc_private.a.agno, bno, 0, owner, offset, flags);
304
305 error = xfs_rmap_query_range(cur, &info.high, &info.high,
306 xfs_rmap_find_left_neighbor_helper, &info);
307 if (error == XFS_BTREE_QUERY_RANGE_ABORT)
307 if (error == -ECANCELED)
308 error = 0;
309 if (*stat)
310 trace_xfs_rmap_find_left_neighbor_result(cur->bc_mp,
311 cur->bc_private.a.agno, irec->rm_startblock,
312 irec->rm_blockcount, irec->rm_owner,
313 irec->rm_offset, irec->rm_flags);
314 return error;
315}

--- 17 unchanged lines hidden (view full) ---

333 if (!XFS_RMAP_NON_INODE_OWNER(rec->rm_owner) &&
334 !(rec->rm_flags & XFS_RMAP_BMBT_BLOCK) &&
335 (rec->rm_offset > info->high.rm_offset ||
336 rec->rm_offset + rec->rm_blockcount <= info->high.rm_offset))
337 return XFS_BTREE_QUERY_RANGE_CONTINUE;
338
339 *info->irec = *rec;
340 *info->stat = 1;
308 error = 0;
309 if (*stat)
310 trace_xfs_rmap_find_left_neighbor_result(cur->bc_mp,
311 cur->bc_private.a.agno, irec->rm_startblock,
312 irec->rm_blockcount, irec->rm_owner,
313 irec->rm_offset, irec->rm_flags);
314 return error;
315}

--- 17 unchanged lines hidden (view full) ---

333 if (!XFS_RMAP_NON_INODE_OWNER(rec->rm_owner) &&
334 !(rec->rm_flags & XFS_RMAP_BMBT_BLOCK) &&
335 (rec->rm_offset > info->high.rm_offset ||
336 rec->rm_offset + rec->rm_blockcount <= info->high.rm_offset))
337 return XFS_BTREE_QUERY_RANGE_CONTINUE;
338
339 *info->irec = *rec;
340 *info->stat = 1;
341 return XFS_BTREE_QUERY_RANGE_ABORT;
341 return -ECANCELED;
342}
343
344/*
345 * Find the record to the left of the given extent, being careful only to
346 * return a match with the same owner and overlapping physical and logical
347 * block ranges. This is the overlapping-interval version of
348 * xfs_rmap_lookup_le.
349 */

--- 21 unchanged lines hidden (view full) ---

371 *stat = 0;
372 info.irec = irec;
373 info.stat = stat;
374
375 trace_xfs_rmap_lookup_le_range(cur->bc_mp,
376 cur->bc_private.a.agno, bno, 0, owner, offset, flags);
377 error = xfs_rmap_query_range(cur, &info.high, &info.high,
378 xfs_rmap_lookup_le_range_helper, &info);
342}
343
344/*
345 * Find the record to the left of the given extent, being careful only to
346 * return a match with the same owner and overlapping physical and logical
347 * block ranges. This is the overlapping-interval version of
348 * xfs_rmap_lookup_le.
349 */

--- 21 unchanged lines hidden (view full) ---

371 *stat = 0;
372 info.irec = irec;
373 info.stat = stat;
374
375 trace_xfs_rmap_lookup_le_range(cur->bc_mp,
376 cur->bc_private.a.agno, bno, 0, owner, offset, flags);
377 error = xfs_rmap_query_range(cur, &info.high, &info.high,
378 xfs_rmap_lookup_le_range_helper, &info);
379 if (error == XFS_BTREE_QUERY_RANGE_ABORT)
379 if (error == -ECANCELED)
380 error = 0;
381 if (*stat)
382 trace_xfs_rmap_lookup_le_range_result(cur->bc_mp,
383 cur->bc_private.a.agno, irec->rm_startblock,
384 irec->rm_blockcount, irec->rm_owner,
385 irec->rm_offset, irec->rm_flags);
386 return error;
387}

--- 2116 unchanged lines hidden (view full) ---

2504 void *priv)
2505{
2506 struct xfs_rmap_key_state *rks = priv;
2507
2508 if (rks->owner == rec->rm_owner && rks->offset == rec->rm_offset &&
2509 ((rks->flags & rec->rm_flags) & XFS_RMAP_KEY_FLAGS) == rks->flags)
2510 return 0;
2511 rks->has_rmap = true;
380 error = 0;
381 if (*stat)
382 trace_xfs_rmap_lookup_le_range_result(cur->bc_mp,
383 cur->bc_private.a.agno, irec->rm_startblock,
384 irec->rm_blockcount, irec->rm_owner,
385 irec->rm_offset, irec->rm_flags);
386 return error;
387}

--- 2116 unchanged lines hidden (view full) ---

2504 void *priv)
2505{
2506 struct xfs_rmap_key_state *rks = priv;
2507
2508 if (rks->owner == rec->rm_owner && rks->offset == rec->rm_offset &&
2509 ((rks->flags & rec->rm_flags) & XFS_RMAP_KEY_FLAGS) == rks->flags)
2510 return 0;
2511 rks->has_rmap = true;
2512 return XFS_BTREE_QUERY_RANGE_ABORT;
2512 return -ECANCELED;
2513}
2514
2515/*
2516 * Given an extent and some owner info, can we find records overlapping
2517 * the extent whose owner info does not match the given owner?
2518 */
2519int
2520xfs_rmap_has_other_keys(

--- 54 unchanged lines hidden ---
2513}
2514
2515/*
2516 * Given an extent and some owner info, can we find records overlapping
2517 * the extent whose owner info does not match the given owner?
2518 */
2519int
2520xfs_rmap_has_other_keys(

--- 54 unchanged lines hidden ---