]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blobdiff - libxfs/xfs_iext_tree.c
xfs: maintain a sequence count for inode fork manipulations
[thirdparty/xfsprogs-dev.git] / libxfs / xfs_iext_tree.c
index 321db1858bc1d1162ea197c86c4fe5960c95fd21..be662077c92525621ab8c54509a4b4710eccae03 100644 (file)
@@ -1,14 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
  * Copyright (c) 2017 Christoph Hellwig.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
- * more details.
  */
 
 // #include <linux/cache.h>
@@ -632,6 +624,8 @@ xfs_iext_insert(
        struct xfs_iext_leaf    *new = NULL;
        int                     nr_entries, i;
 
+       ifp->if_seq++;
+
        if (ifp->if_height == 0)
                xfs_iext_alloc_root(ifp, cur);
        else if (ifp->if_height == 1)
@@ -872,6 +866,8 @@ xfs_iext_remove(
        ASSERT(ifp->if_u1.if_root != NULL);
        ASSERT(xfs_iext_valid(ifp, cur));
 
+       ifp->if_seq++;
+
        nr_entries = xfs_iext_leaf_nr_entries(ifp, leaf, cur->pos) - 1;
        for (i = cur->pos; i < nr_entries; i++)
                leaf->recs[i] = leaf->recs[i + 1];
@@ -978,6 +974,8 @@ xfs_iext_update_extent(
 {
        struct xfs_ifork        *ifp = xfs_iext_state_to_fork(ip, state);
 
+       ifp->if_seq++;
+
        if (cur->pos == 0) {
                struct xfs_bmbt_irec    old;