// SPDX-License-Identifier: GPL-2.0
/*
*
* Copyright (C) 2019-2021 Paragon Software GmbH, All rights reserved.
*
* This code builds two trees of free clusters extents.
* Trees are sorted by start of extent and by length of extent.
* NTFS_MAX_WND_EXTENTS defines the maximum number of elements in trees.
* In extreme case code reads on-disk bitmap to find free clusters.
*
*/
#include <linux/buffer_head.h>
#include <linux/fs.h>
#include <linux/kernel.h>
#include "ntfs.h"
#include "ntfs_fs.h"
/*
* Maximum number of extents in tree.
*/
#define NTFS_MAX_WND_EXTENTS (32u * 1024u)
struct rb_node_key {
struct rb_node node;
size_t key;
};
struct e_node