]> Git Repo - linux.git/blobdiff - fs/ubifs/tnc_misc.c
Merge tag 'amd-drm-next-6.10-2024-04-19' of https://gitlab.freedesktop.org/agd5f...
[linux.git] / fs / ubifs / tnc_misc.c
index 4d686e34e64d99feb54a3ab351fbf31fd6a5a476..d3f8a6aa1f49da522941d9e3e94130715d19c591 100644 (file)
@@ -250,6 +250,28 @@ long ubifs_destroy_tnc_subtree(const struct ubifs_info *c,
        }
 }
 
+/**
+ * ubifs_destroy_tnc_tree - destroy all znodes connected to the TNC tree.
+ * @c: UBIFS file-system description object
+ *
+ * This function destroys the whole TNC tree and updates clean global znode
+ * count.
+ */
+void ubifs_destroy_tnc_tree(struct ubifs_info *c)
+{
+       long n, freed;
+
+       if (!c->zroot.znode)
+               return;
+
+       n = atomic_long_read(&c->clean_zn_cnt);
+       freed = ubifs_destroy_tnc_subtree(c, c->zroot.znode);
+       ubifs_assert(c, freed == n);
+       atomic_long_sub(n, &ubifs_clean_zn_cnt);
+
+       c->zroot.znode = NULL;
+}
+
 /**
  * read_znode - read an indexing node from flash and fill znode.
  * @c: UBIFS file-system description object
This page took 0.024507 seconds and 4 git commands to generate.