diff mbox series

[2/3] btrfs-progs: clear root dirty when we update the root

Message ID 5867c49c060d81c16fff55e20f62c0702ceae91f.1692800798.git.josef@toxicpanda.com (mailing list archive)
State New, archived
Headers show
Series btrfs-progs: a couple fixes | expand

Commit Message

Josef Bacik Aug. 23, 2023, 2:27 p.m. UTC
We don't currently use the bit to track whether or not the root is
dirty, but when we sync ctree.c it uses this bit to determine if we
should add the root to the dirty list.  Clear this bit when we update
the root so that the dirty tracking works properly when we sync ctree.c.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
---
 kernel-shared/transaction.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

David Sterba Aug. 23, 2023, 5:17 p.m. UTC | #1
On Wed, Aug 23, 2023 at 10:27:49AM -0400, Josef Bacik wrote:
> We don't currently use the bit to track whether or not the root is
> dirty, but when we sync ctree.c it uses this bit to determine if we
> should add the root to the dirty list.  Clear this bit when we update
> the root so that the dirty tracking works properly when we sync ctree.c.
> 
> Signed-off-by: Josef Bacik <josef@toxicpanda.com>
> ---
>  kernel-shared/transaction.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/kernel-shared/transaction.c b/kernel-shared/transaction.c
> index d30be5b5..49b435f6 100644
> --- a/kernel-shared/transaction.c
> +++ b/kernel-shared/transaction.c
> @@ -14,6 +14,7 @@
>   * Boston, MA 021110-1307, USA.
>   */
>  
> +#include "kernel-lib/bitops.h"
>  #include "kerncompat.h"
>  #include "kernel-shared/disk-io.h"
>  #include "kernel-shared/transaction.h"

The includes in all files have been reorganized so that they're grouped,
the kerncompat.h is first, then system includes and libraries, then
kernel-lib, kernel-shared, common/, cmds/, the rest.
diff mbox series

Patch

diff --git a/kernel-shared/transaction.c b/kernel-shared/transaction.c
index d30be5b5..49b435f6 100644
--- a/kernel-shared/transaction.c
+++ b/kernel-shared/transaction.c
@@ -14,6 +14,7 @@ 
  * Boston, MA 021110-1307, USA.
  */
 
+#include "kernel-lib/bitops.h"
 #include "kerncompat.h"
 #include "kernel-shared/disk-io.h"
 #include "kernel-shared/transaction.h"
@@ -119,6 +120,7 @@  int commit_tree_roots(struct btrfs_trans_handle *trans,
 		next = fs_info->dirty_cowonly_roots.next;
 		list_del_init(next);
 		root = list_entry(next, struct btrfs_root, dirty_list);
+		clear_bit(BTRFS_ROOT_DIRTY, &root->state);
 		ret = update_cowonly_root(trans, root);
 		free_extent_buffer(root->commit_root);
 		root->commit_root = NULL;