Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
109 commits
Select commit Hold shift + click to select a range
219d33b
Btrfs: remove batch plug in run_scheduled_IO
Sep 1, 2017
69cc715
Btrfs: move finish_wait out of the loop
Sep 1, 2017
45bac0f
Btrfs: use wait_event instead of a single function
Sep 1, 2017
49e83f5
Btrfs: protect conditions within root->log_mutex while waiting
Sep 1, 2017
f78541d
btrfs: Remove redundant forward declarations
lorddoskias Aug 31, 2017
012e513
btrfs: declare TRACE_DEFINE_ENUM for each of show_flush_state enum
asj Aug 30, 2017
c9162bd
Btrfs: make some volumes.c functions static
osandov Aug 23, 2017
718dc5f
Btrfs: fix __user casting in ioctl.c
osandov Aug 23, 2017
ee87cf5
btrfs: copy fsid to super_block s_uuid
asj Aug 1, 2017
9cd3a7e
Btrfs: search parity device wisely
Aug 3, 2017
9b4a9b2
Btrfs: do not async submit for nodatasum inodes
Aug 18, 2017
8ca1995
btrfs: Remove unused variable
lorddoskias Aug 21, 2017
a035751
btrfs: Remove unused parameters from various functions
lorddoskias Aug 21, 2017
ee8c494
btrfs: Remove unused arguments from btrfs_changed_cb_t
lorddoskias Aug 21, 2017
8c70c9f
btrfs: Remove unused parameter from check_direct_IO
lorddoskias Aug 21, 2017
1efb72a
btrfs: Rework error handling of add_extent_mapping in __btrfs_alloc_c…
lorddoskias Aug 21, 2017
c434d21
btrfs: Remove redundant argument of __link_block_group
lorddoskias Aug 21, 2017
9ca2e97
btrfs: tests: Fix a memory leak in error handling path in 'run_test()'
tititiou36 Sep 10, 2017
fa0d088
btrfs: Clean up dead code in root-tree
chggr Sep 9, 2017
3993b11
btrfs: avoid null pointer dereference on fs_info when calling btrfs_crit
Sep 11, 2017
d8953d6
btrfs: convert all mount option checking code to use btrfs_test_opt
satoru-takeuchi Sep 12, 2017
6300463
Btrfs: make plug in writing meta blocks really work
Aug 21, 2017
18fdc67
Btrfs: remove bio_flags which indicates a meta block of log-tree
Sep 13, 2017
6939f66
Btrfs: fix confusing worker helper info in stacktrace
Sep 13, 2017
3afb0c5
btrfs: return -ENOMEM on allocation failure in btrfsic
Sep 20, 2017
315d8e9
btrfs: make array types static const, reduces object code size
Sep 19, 2017
785884f
Btrfs: fix memory leak in raid56
Sep 22, 2017
eef16ba
Btrfs: send, apply asynchronous page cache readahead to enhance page …
peterh-syno Sep 15, 2017
996478c
btrfs: change how we decide to commit transactions during flushing
Aug 22, 2017
6018ba0
Btrfs: cleanup 'start' subtraction from try uncompressed inline extent
nefelim4ag Sep 14, 2017
c3267bb
btrfs: Refactor check_leaf function for later expansion
Aug 23, 2017
7f43d4a
btrfs: Check if item pointer overlaps with the item itself
Aug 23, 2017
40c3c40
btrfs: Add sanity check for EXTENT_DATA when reading out leaf
Aug 23, 2017
4b865ca
btrfs: Add checker for EXTENT_CSUM
Aug 23, 2017
0af2c4b
btrfs: undo writable superblocke when sprouting fails
asj Sep 28, 2017
d31c32f
btrfs: fix BUG_ON in btrfs_init_new_device()
asj Sep 28, 2017
7132a26
btrfs: error out if btrfs_attach_transaction() fails
asj Sep 28, 2017
9417ebc
btrfs: Explicitly handle btrfs_update_root failure
lorddoskias Sep 28, 2017
efd3815
btrfs: Refactor transaction handling in received subvolume ioctl
lorddoskias Sep 28, 2017
897ca81
btrfs: Fix bool initialization/comparison
thomasmey Oct 7, 2017
a969f4c
btrfs: prefix sysfs attribute struct names
knorrie Oct 8, 2017
a7e3c5f
btrfs: use appropriate replacements for __sb_{start,end}_write calls
rakeshpandit Oct 10, 2017
1170862
Btrfs: compress_file_range remove dead variable num_bytes
nefelim4ag Oct 3, 2017
557ea5d
btrfs: Move leaf and node validation checker to tree-checker.c
Oct 9, 2017
bba4f29
btrfs: tree-checker: Enhance btrfs_check_node output
Oct 9, 2017
478d01b
btrfs: tree-checker: Enhance output for btrfs_check_leaf
Oct 9, 2017
d508c5f
btrfs: tree-checker: Enhance output for check_csum_item
Oct 9, 2017
8806d71
btrfs: tree-checker: Enhance output for check_extent_data_item
Oct 9, 2017
f851689
Btrfs: remove nr_async_bios
Sep 7, 2017
80e03a2
Btrfs: do not make defrag wait on async_delalloc_pages
Sep 7, 2017
736cd52
Btrfs: remove nr_async_submits and async_submit_draining
Sep 7, 2017
709a95c
btrfs: tree-checker: use %zu format string for size_t
arndb Oct 13, 2017
9e882d6
btrfs: Clean up unused variables in free-space-tree.c
chggr Oct 12, 2017
adfb69a
btrfs: add_missing_dev() should return the actual error
asj Oct 11, 2017
45dbdbc
btrfs: fix EIO misuse to report missing degraded option
asj Oct 9, 2017
5a2b8e6
btrfs: declare btrfs_report_missing_device() static
asj Oct 9, 2017
2b902df
btrfs: fix use of error or warning for missing device
asj Oct 9, 2017
2351f43
btrfs: fix send ioctl on 32bit with 64bit kernel
josefbacik Sep 27, 2017
6aa2126
btrfs: scrub: get rid of sector_t
kdave Oct 4, 2017
6c5a4e2
btrfs: rename page offset parameter in submit_extent_page
kdave Oct 4, 2017
6273b7f
btrfs: get rid of sector_t and use u64 offset in submit_extent_page
kdave Oct 4, 2017
fb59237
btrfs: add ref-verify mount option
josefbacik Sep 29, 2017
84f7d8e
btrfs: pass root to various extent ref mod functions
josefbacik Sep 29, 2017
fd708b8
Btrfs: add a extent ref verify tool
josefbacik Sep 29, 2017
7c77743
Btrfs: only check delayed ref usage in should_end_transaction
josefbacik Sep 29, 2017
2eadaa2
btrfs: add a helper to return a head ref
josefbacik Sep 29, 2017
b00e625
btrfs: move extent_op cleanup to a helper
josefbacik Sep 29, 2017
194ab0b
btrfs: breakout empty head cleanup to a helper
josefbacik Sep 29, 2017
1ce7a5e
btrfs: move ref_mod modification into the if (ref) logic
josefbacik Sep 29, 2017
c1103f7
btrfs: move all ref head cleanup to the helper function
josefbacik Sep 29, 2017
d278850
btrfs: remove delayed_ref_node from ref_head
josefbacik Sep 29, 2017
3b60d43
btrfs: remove type argument from comp_tree_refs
josefbacik Sep 29, 2017
bf2681c
btrfs: add assertions for releasing trans handle reservations
josefbacik Sep 29, 2017
2dbe0c7
btrfs: use BLK_STS defines where needed
asj Oct 14, 2017
79f015f
btrfs: cleanup extent locking sequence
goldwynr Oct 16, 2017
de48373
btrfs: use need_full_stripe() in __btrfs_map_block()
asj Oct 12, 2017
102ed2c
btrfs: fix false EIO for missing device
asj Oct 14, 2017
859a58a
btrfs: Use bd_dev to generate index when dev_state_hashtable add items.
Oct 11, 2017
d4417e2
btrfs: Replace opencoded sizes with their symbolic constants
lorddoskias Oct 16, 2017
f51d2b5
btrfs: allow to set compression level for zlib
kdave Sep 15, 2017
fa4d885
btrfs: allow setting zlib compression level via :9
kilobyte Sep 15, 2017
6dd38f8
btrfs: remove BUG_ON in btrfs_rm_dev_replace_free_srcdev()
asj Oct 16, 2017
eb7b9d6
btrfs: send: remove unused code
lorddoskias Oct 16, 2017
c995ab3
btrfs: add a flag to iterate_inodes_from_logical to find all extent r…
Sep 22, 2017
d24a67b
btrfs: add a flags argument to LOGICAL_INO and call it LOGICAL_INO_V2
Sep 22, 2017
b115e3b
btrfs: increase output size for LOGICAL_INO_V2 ioctl
Sep 22, 2017
8b62f87
Btrfs: rework outstanding_extents
josefbacik Oct 19, 2017
dd48d40
btrfs: add tracepoints for outstanding extents mods
josefbacik Oct 19, 2017
69fe2d7
btrfs: make the delalloc block rsv per inode
josefbacik Oct 19, 2017
c7ad7c8
btrfs: switch args for comp_*_refs
josefbacik Oct 19, 2017
1d148e5
btrfs: add a comp_refs() helper
josefbacik Oct 19, 2017
0e0adbc
btrfs: track refs in a rb_tree instead of a list
josefbacik Oct 19, 2017
ce8ea7c
btrfs: don't call btrfs_start_delalloc_roots in flushoncommit
josefbacik Oct 19, 2017
ddfae63
btrfs: move btrfs_truncate_block out of trans handle
josefbacik Oct 19, 2017
4e439a0
Btrfs: compression: separate heuristic/compression workspaces
nefelim4ag Sep 28, 2017
17b5a6c
Btrfs: heuristic: add bucket and sample counters and other defines
nefelim4ag Sep 28, 2017
a440d48
Btrfs: heuristic: implement sampling logic
nefelim4ag Sep 28, 2017
1fe4f6f
Btrfs: heuristic: add detection of repeated data patterns
nefelim4ag Sep 28, 2017
a288e92
Btrfs: heuristic: add byte set calculation
nefelim4ag Sep 28, 2017
858177d
Btrfs: heuristic: add byte core set calculation
nefelim4ag Sep 28, 2017
1956243
Btrfs: heuristic: add Shannon entropy calculation
nefelim4ag Oct 8, 2017
d28e649
btrfs: Fix bug for misused dev_t when lookup in dev state hash table.
Oct 19, 2017
f82b735
Btrfs: add write_flags for compression bio
Oct 24, 2017
5e9f2ad
btrfs: Fix transaction abort during failure in btrfs_rm_dev_item
lorddoskias Oct 23, 2017
3065ae5
btrfs: add missing device::flush_bio puts
kdave Oct 30, 2017
619c47f
btrfs: dev_alloc_list is not protected by RCU, use normal list_del
kdave Jun 19, 2017
56a0e70
Btrfs: bail out gracefully rather than BUG_ON
Oct 30, 2017
f48bf66
Btrfs: move definition of the function btrfs_find_new_delalloc_bytes
fdmanana Nov 3, 2017
e3b8a48
Btrfs: fix reported number of inode blocks after buffered append writes
fdmanana Nov 4, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions fs/btrfs/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,14 @@ config BTRFS_ASSERT
any of the assertions trip. This is meant for btrfs developers only.

If unsure, say N.

config BTRFS_FS_REF_VERIFY
bool "Btrfs with the ref verify tool compiled in"
depends on BTRFS_FS
default n
help
Enable run-time extent reference verification instrumentation. This
is meant to be used by btrfs developers for tracking down extent
reference problems or verifying they didn't break something.

If unsure, say N.
3 changes: 2 additions & 1 deletion fs/btrfs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ btrfs-y += super.o ctree.o extent-tree.o print-tree.o root-tree.o dir-item.o \
export.o tree-log.o free-space-cache.o zlib.o lzo.o zstd.o \
compression.o delayed-ref.o relocation.o delayed-inode.o scrub.o \
reada.o backref.o ulist.o qgroup.o send.o dev-replace.o raid56.o \
uuid-tree.o props.o hash.o free-space-tree.o
uuid-tree.o props.o hash.o free-space-tree.o tree-checker.o

btrfs-$(CONFIG_BTRFS_FS_POSIX_ACL) += acl.o
btrfs-$(CONFIG_BTRFS_FS_CHECK_INTEGRITY) += check-integrity.o
btrfs-$(CONFIG_BTRFS_FS_REF_VERIFY) += ref-verify.o

btrfs-$(CONFIG_BTRFS_FS_RUN_SANITY_TESTS) += tests/free-space-tests.o \
tests/extent-buffer-tests.o tests/btrfs-tests.o \
Expand Down
2 changes: 1 addition & 1 deletion fs/btrfs/async-thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ struct btrfs_workqueue {
static void normal_work_helper(struct btrfs_work *work);

#define BTRFS_WORK_HELPER(name) \
void btrfs_##name(struct work_struct *arg) \
noinline_for_stack void btrfs_##name(struct work_struct *arg) \
{ \
struct btrfs_work *work = container_of(arg, struct btrfs_work, \
normal_work); \
Expand Down
72 changes: 44 additions & 28 deletions fs/btrfs/backref.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,14 @@ static int check_extent_in_eb(const struct btrfs_key *key,
const struct extent_buffer *eb,
const struct btrfs_file_extent_item *fi,
u64 extent_item_pos,
struct extent_inode_elem **eie)
struct extent_inode_elem **eie,
bool ignore_offset)
{
u64 offset = 0;
struct extent_inode_elem *e;

if (!btrfs_file_extent_compression(eb, fi) &&
if (!ignore_offset &&
!btrfs_file_extent_compression(eb, fi) &&
!btrfs_file_extent_encryption(eb, fi) &&
!btrfs_file_extent_other_encoding(eb, fi)) {
u64 data_offset;
Expand Down Expand Up @@ -84,7 +86,8 @@ static void free_inode_elem_list(struct extent_inode_elem *eie)

static int find_extent_in_eb(const struct extent_buffer *eb,
u64 wanted_disk_byte, u64 extent_item_pos,
struct extent_inode_elem **eie)
struct extent_inode_elem **eie,
bool ignore_offset)
{
u64 disk_byte;
struct btrfs_key key;
Expand Down Expand Up @@ -113,7 +116,7 @@ static int find_extent_in_eb(const struct extent_buffer *eb,
if (disk_byte != wanted_disk_byte)
continue;

ret = check_extent_in_eb(&key, eb, fi, extent_item_pos, eie);
ret = check_extent_in_eb(&key, eb, fi, extent_item_pos, eie, ignore_offset);
if (ret < 0)
return ret;
}
Expand Down Expand Up @@ -419,7 +422,7 @@ static int add_indirect_ref(const struct btrfs_fs_info *fs_info,
static int add_all_parents(struct btrfs_root *root, struct btrfs_path *path,
struct ulist *parents, struct prelim_ref *ref,
int level, u64 time_seq, const u64 *extent_item_pos,
u64 total_refs)
u64 total_refs, bool ignore_offset)
{
int ret = 0;
int slot;
Expand Down Expand Up @@ -472,7 +475,7 @@ static int add_all_parents(struct btrfs_root *root, struct btrfs_path *path,
if (extent_item_pos) {
ret = check_extent_in_eb(&key, eb, fi,
*extent_item_pos,
&eie);
&eie, ignore_offset);
if (ret < 0)
break;
}
Expand Down Expand Up @@ -510,7 +513,8 @@ static int add_all_parents(struct btrfs_root *root, struct btrfs_path *path,
static int resolve_indirect_ref(struct btrfs_fs_info *fs_info,
struct btrfs_path *path, u64 time_seq,
struct prelim_ref *ref, struct ulist *parents,
const u64 *extent_item_pos, u64 total_refs)
const u64 *extent_item_pos, u64 total_refs,
bool ignore_offset)
{
struct btrfs_root *root;
struct btrfs_key root_key;
Expand Down Expand Up @@ -581,7 +585,7 @@ static int resolve_indirect_ref(struct btrfs_fs_info *fs_info,
}

ret = add_all_parents(root, path, parents, ref, level, time_seq,
extent_item_pos, total_refs);
extent_item_pos, total_refs, ignore_offset);
out:
path->lowest_level = 0;
btrfs_release_path(path);
Expand Down Expand Up @@ -616,7 +620,7 @@ static int resolve_indirect_refs(struct btrfs_fs_info *fs_info,
struct btrfs_path *path, u64 time_seq,
struct preftrees *preftrees,
const u64 *extent_item_pos, u64 total_refs,
struct share_check *sc)
struct share_check *sc, bool ignore_offset)
{
int err;
int ret = 0;
Expand Down Expand Up @@ -661,7 +665,7 @@ static int resolve_indirect_refs(struct btrfs_fs_info *fs_info,
}
err = resolve_indirect_ref(fs_info, path, time_seq, ref,
parents, extent_item_pos,
total_refs);
total_refs, ignore_offset);
/*
* we can only tolerate ENOENT,otherwise,we should catch error
* and return directly.
Expand Down Expand Up @@ -769,6 +773,7 @@ static int add_delayed_refs(const struct btrfs_fs_info *fs_info,
struct btrfs_key key;
struct btrfs_key tmp_op_key;
struct btrfs_key *op_key = NULL;
struct rb_node *n;
int count;
int ret = 0;

Expand All @@ -778,7 +783,9 @@ static int add_delayed_refs(const struct btrfs_fs_info *fs_info,
}

spin_lock(&head->lock);
list_for_each_entry(node, &head->ref_list, list) {
for (n = rb_first(&head->ref_tree); n; n = rb_next(n)) {
node = rb_entry(n, struct btrfs_delayed_ref_node,
ref_node);
if (node->seq > seq)
continue;

Expand Down Expand Up @@ -1107,13 +1114,17 @@ static int add_keyed_refs(struct btrfs_fs_info *fs_info,
*
* Otherwise this returns 0 for success and <0 for an error.
*
* If ignore_offset is set to false, only extent refs whose offsets match
* extent_item_pos are returned. If true, every extent ref is returned
* and extent_item_pos is ignored.
*
* FIXME some caching might speed things up
*/
static int find_parent_nodes(struct btrfs_trans_handle *trans,
struct btrfs_fs_info *fs_info, u64 bytenr,
u64 time_seq, struct ulist *refs,
struct ulist *roots, const u64 *extent_item_pos,
struct share_check *sc)
struct share_check *sc, bool ignore_offset)
{
struct btrfs_key key;
struct btrfs_path *path;
Expand Down Expand Up @@ -1178,7 +1189,7 @@ static int find_parent_nodes(struct btrfs_trans_handle *trans,
head = btrfs_find_delayed_ref_head(delayed_refs, bytenr);
if (head) {
if (!mutex_trylock(&head->mutex)) {
refcount_inc(&head->node.refs);
refcount_inc(&head->refs);
spin_unlock(&delayed_refs->lock);

btrfs_release_path(path);
Expand All @@ -1189,7 +1200,7 @@ static int find_parent_nodes(struct btrfs_trans_handle *trans,
*/
mutex_lock(&head->mutex);
mutex_unlock(&head->mutex);
btrfs_put_delayed_ref(&head->node);
btrfs_put_delayed_ref_head(head);
goto again;
}
spin_unlock(&delayed_refs->lock);
Expand Down Expand Up @@ -1235,7 +1246,7 @@ static int find_parent_nodes(struct btrfs_trans_handle *trans,
WARN_ON(!RB_EMPTY_ROOT(&preftrees.indirect_missing_keys.root));

ret = resolve_indirect_refs(fs_info, path, time_seq, &preftrees,
extent_item_pos, total_refs, sc);
extent_item_pos, total_refs, sc, ignore_offset);
if (ret)
goto out;

Expand Down Expand Up @@ -1282,7 +1293,7 @@ static int find_parent_nodes(struct btrfs_trans_handle *trans,
btrfs_tree_read_lock(eb);
btrfs_set_lock_blocking_rw(eb, BTRFS_READ_LOCK);
ret = find_extent_in_eb(eb, bytenr,
*extent_item_pos, &eie);
*extent_item_pos, &eie, ignore_offset);
btrfs_tree_read_unlock_blocking(eb);
free_extent_buffer(eb);
if (ret < 0)
Expand Down Expand Up @@ -1350,7 +1361,7 @@ static void free_leaf_list(struct ulist *blocks)
static int btrfs_find_all_leafs(struct btrfs_trans_handle *trans,
struct btrfs_fs_info *fs_info, u64 bytenr,
u64 time_seq, struct ulist **leafs,
const u64 *extent_item_pos)
const u64 *extent_item_pos, bool ignore_offset)
{
int ret;

Expand All @@ -1359,7 +1370,7 @@ static int btrfs_find_all_leafs(struct btrfs_trans_handle *trans,
return -ENOMEM;

ret = find_parent_nodes(trans, fs_info, bytenr, time_seq,
*leafs, NULL, extent_item_pos, NULL);
*leafs, NULL, extent_item_pos, NULL, ignore_offset);
if (ret < 0 && ret != -ENOENT) {
free_leaf_list(*leafs);
return ret;
Expand All @@ -1383,7 +1394,8 @@ static int btrfs_find_all_leafs(struct btrfs_trans_handle *trans,
*/
static int btrfs_find_all_roots_safe(struct btrfs_trans_handle *trans,
struct btrfs_fs_info *fs_info, u64 bytenr,
u64 time_seq, struct ulist **roots)
u64 time_seq, struct ulist **roots,
bool ignore_offset)
{
struct ulist *tmp;
struct ulist_node *node = NULL;
Expand All @@ -1402,7 +1414,7 @@ static int btrfs_find_all_roots_safe(struct btrfs_trans_handle *trans,
ULIST_ITER_INIT(&uiter);
while (1) {
ret = find_parent_nodes(trans, fs_info, bytenr, time_seq,
tmp, *roots, NULL, NULL);
tmp, *roots, NULL, NULL, ignore_offset);
if (ret < 0 && ret != -ENOENT) {
ulist_free(tmp);
ulist_free(*roots);
Expand All @@ -1421,14 +1433,15 @@ static int btrfs_find_all_roots_safe(struct btrfs_trans_handle *trans,

int btrfs_find_all_roots(struct btrfs_trans_handle *trans,
struct btrfs_fs_info *fs_info, u64 bytenr,
u64 time_seq, struct ulist **roots)
u64 time_seq, struct ulist **roots,
bool ignore_offset)
{
int ret;

if (!trans)
down_read(&fs_info->commit_root_sem);
ret = btrfs_find_all_roots_safe(trans, fs_info, bytenr,
time_seq, roots);
time_seq, roots, ignore_offset);
if (!trans)
up_read(&fs_info->commit_root_sem);
return ret;
Expand Down Expand Up @@ -1483,7 +1496,7 @@ int btrfs_check_shared(struct btrfs_root *root, u64 inum, u64 bytenr)
ULIST_ITER_INIT(&uiter);
while (1) {
ret = find_parent_nodes(trans, fs_info, bytenr, elem.seq, tmp,
roots, NULL, &shared);
roots, NULL, &shared, false);
if (ret == BACKREF_FOUND_SHARED) {
/* this is the only condition under which we return 1 */
ret = 1;
Expand Down Expand Up @@ -1877,7 +1890,8 @@ static int iterate_leaf_refs(struct btrfs_fs_info *fs_info,
int iterate_extent_inodes(struct btrfs_fs_info *fs_info,
u64 extent_item_objectid, u64 extent_item_pos,
int search_commit_root,
iterate_extent_inodes_t *iterate, void *ctx)
iterate_extent_inodes_t *iterate, void *ctx,
bool ignore_offset)
{
int ret;
struct btrfs_trans_handle *trans = NULL;
Expand All @@ -1903,14 +1917,15 @@ int iterate_extent_inodes(struct btrfs_fs_info *fs_info,

ret = btrfs_find_all_leafs(trans, fs_info, extent_item_objectid,
tree_mod_seq_elem.seq, &refs,
&extent_item_pos);
&extent_item_pos, ignore_offset);
if (ret)
goto out;

ULIST_ITER_INIT(&ref_uiter);
while (!ret && (ref_node = ulist_next(refs, &ref_uiter))) {
ret = btrfs_find_all_roots_safe(trans, fs_info, ref_node->val,
tree_mod_seq_elem.seq, &roots);
tree_mod_seq_elem.seq, &roots,
ignore_offset);
if (ret)
break;
ULIST_ITER_INIT(&root_uiter);
Expand Down Expand Up @@ -1943,7 +1958,8 @@ int iterate_extent_inodes(struct btrfs_fs_info *fs_info,

int iterate_inodes_from_logical(u64 logical, struct btrfs_fs_info *fs_info,
struct btrfs_path *path,
iterate_extent_inodes_t *iterate, void *ctx)
iterate_extent_inodes_t *iterate, void *ctx,
bool ignore_offset)
{
int ret;
u64 extent_item_pos;
Expand All @@ -1961,7 +1977,7 @@ int iterate_inodes_from_logical(u64 logical, struct btrfs_fs_info *fs_info,
extent_item_pos = logical - found_key.objectid;
ret = iterate_extent_inodes(fs_info, found_key.objectid,
extent_item_pos, search_commit_root,
iterate, ctx);
iterate, ctx, ignore_offset);

return ret;
}
Expand Down
8 changes: 5 additions & 3 deletions fs/btrfs/backref.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,19 @@ int tree_backref_for_extent(unsigned long *ptr, struct extent_buffer *eb,
int iterate_extent_inodes(struct btrfs_fs_info *fs_info,
u64 extent_item_objectid,
u64 extent_offset, int search_commit_root,
iterate_extent_inodes_t *iterate, void *ctx);
iterate_extent_inodes_t *iterate, void *ctx,
bool ignore_offset);

int iterate_inodes_from_logical(u64 logical, struct btrfs_fs_info *fs_info,
struct btrfs_path *path,
iterate_extent_inodes_t *iterate, void *ctx);
iterate_extent_inodes_t *iterate, void *ctx,
bool ignore_offset);

int paths_from_inode(u64 inum, struct inode_fs_paths *ipath);

int btrfs_find_all_roots(struct btrfs_trans_handle *trans,
struct btrfs_fs_info *fs_info, u64 bytenr,
u64 time_seq, struct ulist **roots);
u64 time_seq, struct ulist **roots, bool ignore_offset);
char *btrfs_ref_to_path(struct btrfs_root *fs_root, struct btrfs_path *path,
u32 name_len, unsigned long name_off,
struct extent_buffer *eb_in, u64 parent,
Expand Down
29 changes: 20 additions & 9 deletions fs/btrfs/btrfs_inode.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,13 @@
#define BTRFS_INODE_ORPHAN_META_RESERVED 1
#define BTRFS_INODE_DUMMY 2
#define BTRFS_INODE_IN_DEFRAG 3
#define BTRFS_INODE_DELALLOC_META_RESERVED 4
#define BTRFS_INODE_HAS_ORPHAN_ITEM 5
#define BTRFS_INODE_HAS_ASYNC_EXTENT 6
#define BTRFS_INODE_NEEDS_FULL_SYNC 7
#define BTRFS_INODE_COPY_EVERYTHING 8
#define BTRFS_INODE_IN_DELALLOC_LIST 9
#define BTRFS_INODE_READDIO_NEED_LOCK 10
#define BTRFS_INODE_HAS_PROPS 11
#define BTRFS_INODE_HAS_ORPHAN_ITEM 4
#define BTRFS_INODE_HAS_ASYNC_EXTENT 5
#define BTRFS_INODE_NEEDS_FULL_SYNC 6
#define BTRFS_INODE_COPY_EVERYTHING 7
#define BTRFS_INODE_IN_DELALLOC_LIST 8
#define BTRFS_INODE_READDIO_NEED_LOCK 9
#define BTRFS_INODE_HAS_PROPS 10

/* in memory btrfs inode */
struct btrfs_inode {
Expand Down Expand Up @@ -176,7 +175,8 @@ struct btrfs_inode {
* of extent items we've reserved metadata for.
*/
unsigned outstanding_extents;
unsigned reserved_extents;

struct btrfs_block_rsv block_rsv;

/*
* Cached values of inode properties
Expand Down Expand Up @@ -267,6 +267,17 @@ static inline bool btrfs_is_free_space_inode(struct btrfs_inode *inode)
return false;
}

static inline void btrfs_mod_outstanding_extents(struct btrfs_inode *inode,
int mod)
{
lockdep_assert_held(&inode->lock);
inode->outstanding_extents += mod;
if (btrfs_is_free_space_inode(inode))
return;
trace_btrfs_inode_mod_outstanding_extents(inode->root, btrfs_ino(inode),
mod);
}

static inline int btrfs_inode_in_log(struct btrfs_inode *inode, u64 generation)
{
int ret = 0;
Expand Down
Loading