hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/fs/xfs/libxfs/xfs_rtbitmap.c
....@@ -13,17 +13,9 @@
1313 #include "xfs_mount.h"
1414 #include "xfs_inode.h"
1515 #include "xfs_bmap.h"
16
-#include "xfs_bmap_util.h"
17
-#include "xfs_bmap_btree.h"
18
-#include "xfs_alloc.h"
19
-#include "xfs_error.h"
2016 #include "xfs_trans.h"
21
-#include "xfs_trans_space.h"
22
-#include "xfs_trace.h"
23
-#include "xfs_buf.h"
24
-#include "xfs_icache.h"
2517 #include "xfs_rtalloc.h"
26
-
18
+#include "xfs_error.h"
2719
2820 /*
2921 * Realtime allocator bitmap functions shared with userspace.
....@@ -74,11 +66,11 @@
7466
7567 ip = issum ? mp->m_rsumip : mp->m_rbmip;
7668
77
- error = xfs_bmapi_read(ip, block, 1, &map, &nmap, XFS_DATA_FORK);
69
+ error = xfs_bmapi_read(ip, block, 1, &map, &nmap, 0);
7870 if (error)
7971 return error;
8072
81
- if (nmap == 0 || !xfs_bmap_is_real_extent(&map))
73
+ if (XFS_IS_CORRUPT(mp, nmap == 0 || !xfs_bmap_is_written_extent(&map)))
8274 return -EFSCORRUPTED;
8375
8476 ASSERT(map.br_startblock != NULLFSBLOCK);
....@@ -505,6 +497,12 @@
505497 uint first = (uint)((char *)sp - (char *)bp->b_addr);
506498
507499 *sp += delta;
500
+ if (mp->m_rsum_cache) {
501
+ if (*sp == 0 && log == mp->m_rsum_cache[bbno])
502
+ mp->m_rsum_cache[bbno]++;
503
+ if (*sp != 0 && log < mp->m_rsum_cache[bbno])
504
+ mp->m_rsum_cache[bbno] = log;
505
+ }
508506 xfs_trans_log_buf(tp, bp, first, first + sizeof(*sp) - 1);
509507 }
510508 if (sum)