hc
2024-09-20 a36159eec6ca17402b0e146b86efaf76568dc353
kernel/fs/xfs/libxfs/xfs_iext_tree.c
....@@ -3,18 +3,14 @@
33 * Copyright (c) 2017 Christoph Hellwig.
44 */
55
6
-#include <linux/cache.h>
7
-#include <linux/kernel.h>
8
-#include <linux/slab.h>
96 #include "xfs.h"
7
+#include "xfs_shared.h"
108 #include "xfs_format.h"
119 #include "xfs_bit.h"
1210 #include "xfs_log_format.h"
1311 #include "xfs_inode.h"
14
-#include "xfs_inode_fork.h"
1512 #include "xfs_trans_resv.h"
1613 #include "xfs_mount.h"
17
-#include "xfs_bmap.h"
1814 #include "xfs_trace.h"
1915
2016 /*
....@@ -600,30 +596,29 @@
600596 struct xfs_ifork *ifp,
601597 struct xfs_iext_cursor *cur)
602598 {
603
- size_t new_size = ifp->if_bytes + sizeof(struct xfs_iext_rec);
599
+ int64_t new_size = ifp->if_bytes + sizeof(struct xfs_iext_rec);
604600 void *new;
605601
606602 /* account for the prev/next pointers */
607603 if (new_size / sizeof(struct xfs_iext_rec) == RECS_PER_LEAF)
608604 new_size = NODE_SIZE;
609605
610
- new = kmem_realloc(ifp->if_u1.if_root, new_size, KM_NOFS);
606
+ new = krealloc(ifp->if_u1.if_root, new_size, GFP_NOFS | __GFP_NOFAIL);
611607 memset(new + ifp->if_bytes, 0, new_size - ifp->if_bytes);
612608 ifp->if_u1.if_root = new;
613609 cur->leaf = new;
614610 }
615611
616612 /*
617
- * Increment the sequence counter if we are on a COW fork. This allows
618
- * the writeback code to skip looking for a COW extent if the COW fork
619
- * hasn't changed. We use WRITE_ONCE here to ensure the update to the
620
- * sequence counter is seen before the modifications to the extent
621
- * tree itself take effect.
613
+ * Increment the sequence counter on extent tree changes. If we are on a COW
614
+ * fork, this allows the writeback code to skip looking for a COW extent if the
615
+ * COW fork hasn't changed. We use WRITE_ONCE here to ensure the update to the
616
+ * sequence counter is seen before the modifications to the extent tree itself
617
+ * take effect.
622618 */
623
-static inline void xfs_iext_inc_seq(struct xfs_ifork *ifp, int state)
619
+static inline void xfs_iext_inc_seq(struct xfs_ifork *ifp)
624620 {
625
- if (state & BMAP_COWFORK)
626
- WRITE_ONCE(ifp->if_seq, READ_ONCE(ifp->if_seq) + 1);
621
+ WRITE_ONCE(ifp->if_seq, READ_ONCE(ifp->if_seq) + 1);
627622 }
628623
629624 void
....@@ -638,7 +633,7 @@
638633 struct xfs_iext_leaf *new = NULL;
639634 int nr_entries, i;
640635
641
- xfs_iext_inc_seq(ifp, state);
636
+ xfs_iext_inc_seq(ifp);
642637
643638 if (ifp->if_height == 0)
644639 xfs_iext_alloc_root(ifp, cur);
....@@ -880,7 +875,7 @@
880875 ASSERT(ifp->if_u1.if_root != NULL);
881876 ASSERT(xfs_iext_valid(ifp, cur));
882877
883
- xfs_iext_inc_seq(ifp, state);
878
+ xfs_iext_inc_seq(ifp);
884879
885880 nr_entries = xfs_iext_leaf_nr_entries(ifp, leaf, cur->pos) - 1;
886881 for (i = cur->pos; i < nr_entries; i++)
....@@ -988,7 +983,7 @@
988983 {
989984 struct xfs_ifork *ifp = xfs_iext_state_to_fork(ip, state);
990985
991
- xfs_iext_inc_seq(ifp, state);
986
+ xfs_iext_inc_seq(ifp);
992987
993988 if (cur->pos == 0) {
994989 struct xfs_bmbt_irec old;