2008-07-28 19:32:19 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2008 Oracle. All rights reserved.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public
|
|
|
|
* License v2 as published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that 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.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public
|
|
|
|
* License along with this program; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 021110-1307, USA.
|
|
|
|
*/
|
2008-07-28 19:32:51 +00:00
|
|
|
#ifndef __REFCACHE__
|
|
|
|
#define __REFCACHE__
|
2008-07-28 19:32:19 +00:00
|
|
|
|
|
|
|
struct btrfs_extent_info {
|
2008-09-29 19:18:18 +00:00
|
|
|
/* bytenr and num_bytes find the extent in the extent allocation tree */
|
2008-07-28 19:32:19 +00:00
|
|
|
u64 bytenr;
|
|
|
|
u64 num_bytes;
|
2008-09-29 19:18:18 +00:00
|
|
|
|
|
|
|
/* objectid and offset find the back reference for the file */
|
2008-07-28 19:32:19 +00:00
|
|
|
u64 objectid;
|
|
|
|
u64 offset;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct btrfs_leaf_ref {
|
|
|
|
struct rb_node rb_node;
|
2008-09-26 14:04:53 +00:00
|
|
|
struct btrfs_leaf_ref_tree *tree;
|
2008-07-28 19:32:19 +00:00
|
|
|
int in_tree;
|
|
|
|
atomic_t usage;
|
|
|
|
|
2008-07-30 20:29:20 +00:00
|
|
|
u64 root_gen;
|
2008-07-28 19:32:19 +00:00
|
|
|
u64 bytenr;
|
|
|
|
u64 owner;
|
|
|
|
u64 generation;
|
|
|
|
int nritems;
|
|
|
|
|
2008-07-28 19:32:51 +00:00
|
|
|
struct list_head list;
|
|
|
|
struct btrfs_extent_info extents[];
|
2008-07-28 19:32:19 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static inline size_t btrfs_leaf_ref_size(int nr_extents)
|
|
|
|
{
|
2008-07-30 20:29:20 +00:00
|
|
|
return sizeof(struct btrfs_leaf_ref) +
|
2008-07-28 19:32:19 +00:00
|
|
|
sizeof(struct btrfs_extent_info) * nr_extents;
|
|
|
|
}
|
2008-07-28 19:32:51 +00:00
|
|
|
#endif
|