Commit 983a5f84 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs

Pull btrfs update from Chris Mason:
 "These are mostly fixes.  The biggest exceptions are Josef's skinny
  extents and Jan Schmidt's code to rebuild our quota indexes if they
  get out of sync (or you enable quotas on an existing filesystem).

  The skinny extents are off by default because they are a new variation
  on the extent allocation tree format.  btrfstune -x enables them, and
  the new format makes the extent allocation tree about 30% smaller.

  I rebased this a few days ago to rework Dave Sterba's crc checks on
  the super block, but almost all of these go back to rc6, since I
  though 3.9 was due any minute.

  The biggest missing fix is the tracepoint bug that was hit late in
  3.9.  I ran into problems with that in overnight testing and I'm still
  tracking it down.  I'll definitely have that fixed for rc2."

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs: (101 commits)
  Btrfs: allow superblock mismatch from older mkfs
  btrfs: enhance superblock checks
  btrfs: fix misleading variable name for flags
  btrfs: use unsigned long type for extent state bits
  Btrfs: improve the loop of scrub_stripe
  btrfs: read entire device info under lock
  btrfs: remove unused gfp mask parameter from release_extent_buffer callchain
  btrfs: handle errors returned from get_tree_block_key
  btrfs: make static code static & remove dead code
  Btrfs: deal with errors in write_dev_supers
  Btrfs: remove almost all of the BUG()'s from tree-log.c
  Btrfs: deal with free space cache errors while replaying log
  Btrfs: automatic rescan after "quota enable" command
  Btrfs: rescan for qgroups
  Btrfs: split btrfs_qgroup_account_ref into four functions
  Btrfs: allocate new chunks if the space is not enough for global rsv
  Btrfs: separate sequence numbers for delayed ref tracking and tree mod log
  btrfs: move leak debug code to functions
  Btrfs: return free space in cow error path
  Btrfs: set UUID in root_item for created trees
  ...
parents 8769e078 667e7d94
BTRFS BTRFS
===== =====
Btrfs is a new copy on write filesystem for Linux aimed at Btrfs is a copy on write filesystem for Linux aimed at
implementing advanced features while focusing on fault tolerance, implementing advanced features while focusing on fault tolerance,
repair and easy administration. Initially developed by Oracle, Btrfs repair and easy administration. Initially developed by Oracle, Btrfs
is licensed under the GPL and open for contribution from anyone. is licensed under the GPL and open for contribution from anyone.
...@@ -34,9 +34,175 @@ The main Btrfs features include: ...@@ -34,9 +34,175 @@ The main Btrfs features include:
* Online filesystem defragmentation * Online filesystem defragmentation
Mount Options
=============
MAILING LIST When mounting a btrfs filesystem, the following option are accepted.
============ Unless otherwise specified, all options default to off.
alloc_start=<bytes>
Debugging option to force all block allocations above a certain
byte threshold on each block device. The value is specified in
bytes, optionally with a K, M, or G suffix, case insensitive.
Default is 1MB.
autodefrag
Detect small random writes into files and queue them up for the
defrag process. Works best for small files; Not well suited for
large database workloads.
check_int
check_int_data
check_int_print_mask=<value>
These debugging options control the behavior of the integrity checking
module (the BTRFS_FS_CHECK_INTEGRITY config option required).
check_int enables the integrity checker module, which examines all
block write requests to ensure on-disk consistency, at a large
memory and CPU cost.
check_int_data includes extent data in the integrity checks, and
implies the check_int option.
check_int_print_mask takes a bitmask of BTRFSIC_PRINT_MASK_* values
as defined in fs/btrfs/check-integrity.c, to control the integrity
checker module behavior.
See comments at the top of fs/btrfs/check-integrity.c for more info.
compress
compress=<type>
compress-force
compress-force=<type>
Control BTRFS file data compression. Type may be specified as "zlib"
"lzo" or "no" (for no compression, used for remounting). If no type
is specified, zlib is used. If compress-force is specified,
all files will be compressed, whether or not they compress well.
If compression is enabled, nodatacow and nodatasum are disabled.
degraded
Allow mounts to continue with missing devices. A read-write mount may
fail with too many devices missing, for example if a stripe member
is completely missing.
device=<devicepath>
Specify a device during mount so that ioctls on the control device
can be avoided. Especialy useful when trying to mount a multi-device
setup as root. May be specified multiple times for multiple devices.
discard
Issue frequent commands to let the block device reclaim space freed by
the filesystem. This is useful for SSD devices, thinly provisioned
LUNs and virtual machine images, but may have a significant
performance impact. (The fstrim command is also available to
initiate batch trims from userspace).
enospc_debug
Debugging option to be more verbose in some ENOSPC conditions.
fatal_errors=<action>
Action to take when encountering a fatal error:
"bug" - BUG() on a fatal error. This is the default.
"panic" - panic() on a fatal error.
flushoncommit
The 'flushoncommit' mount option forces any data dirtied by a write in a
prior transaction to commit as part of the current commit. This makes
the committed state a fully consistent view of the file system from the
application's perspective (i.e., it includes all completed file system
operations). This was previously the behavior only when a snapshot is
created.
inode_cache
Enable free inode number caching. Defaults to off due to an overflow
problem when the free space crcs don't fit inside a single page.
max_inline=<bytes>
Specify the maximum amount of space, in bytes, that can be inlined in
a metadata B-tree leaf. The value is specified in bytes, optionally
with a K, M, or G suffix, case insensitive. In practice, this value
is limited by the root sector size, with some space unavailable due
to leaf headers. For a 4k sectorsize, max inline data is ~3900 bytes.
metadata_ratio=<value>
Specify that 1 metadata chunk should be allocated after every <value>
data chunks. Off by default.
noacl
Disable support for Posix Access Control Lists (ACLs). See the
acl(5) manual page for more information about ACLs.
nobarrier
Disables the use of block layer write barriers. Write barriers ensure
that certain IOs make it through the device cache and are on persistent
storage. If used on a device with a volatile (non-battery-backed)
write-back cache, this option will lead to filesystem corruption on a
system crash or power loss.
nodatacow
Disable data copy-on-write for newly created files. Implies nodatasum,
and disables all compression.
nodatasum
Disable data checksumming for newly created files.
notreelog
Disable the tree logging used for fsync and O_SYNC writes.
recovery
Enable autorecovery attempts if a bad tree root is found at mount time.
Currently this scans a list of several previous tree roots and tries to
use the first readable.
skip_balance
Skip automatic resume of interrupted balance operation after mount.
May be resumed with "btrfs balance resume."
space_cache (*)
Enable the on-disk freespace cache.
nospace_cache
Disable freespace cache loading without clearing the cache.
clear_cache
Force clearing and rebuilding of the disk space cache if something
has gone wrong.
ssd
nossd
ssd_spread
Options to control ssd allocation schemes. By default, BTRFS will
enable or disable ssd allocation heuristics depending on whether a
rotational or nonrotational disk is in use. The ssd and nossd options
can override this autodetection.
The ssd_spread mount option attempts to allocate into big chunks
of unused space, and may perform better on low-end ssds. ssd_spread
implies ssd, enabling all other ssd heuristics as well.
subvol=<path>
Mount subvolume at <path> rather than the root subvolume. <path> is
relative to the top level subvolume.
subvolid=<ID>
Mount subvolume specified by an ID number rather than the root subvolume.
This allows mounting of subvolumes which are not in the root of the mounted
filesystem.
You can use "btrfs subvolume list" to see subvolume ID numbers.
subvolrootid=<objectid> (deprecated)
Mount subvolume specified by <objectid> rather than the root subvolume.
This allows mounting of subvolumes which are not in the root of the mounted
filesystem.
You can use "btrfs subvolume show " to see the object ID for a subvolume.
thread_pool=<number>
The number of worker threads to allocate. The default number is equal
to the number of CPUs + 2, or 8, whichever is smaller.
user_subvol_rm_allowed
Allow subvolumes to be deleted by a non-root user. Use with caution.
MAILING LIST
============
There is a Btrfs mailing list hosted on vger.kernel.org. You can There is a Btrfs mailing list hosted on vger.kernel.org. You can
find details on how to subscribe here: find details on how to subscribe here:
...@@ -49,8 +215,8 @@ http://dir.gmane.org/gmane.comp.file-systems.btrfs ...@@ -49,8 +215,8 @@ http://dir.gmane.org/gmane.comp.file-systems.btrfs
IRC IRC
=== ===
Discussion of Btrfs also occurs on the #btrfs channel of the Freenode Discussion of Btrfs also occurs on the #btrfs channel of the Freenode
IRC network. IRC network.
......
config BTRFS_FS config BTRFS_FS
tristate "Btrfs filesystem Unstable disk format" tristate "Btrfs filesystem support"
select LIBCRC32C select LIBCRC32C
select ZLIB_INFLATE select ZLIB_INFLATE
select ZLIB_DEFLATE select ZLIB_DEFLATE
...@@ -52,3 +52,23 @@ config BTRFS_FS_CHECK_INTEGRITY ...@@ -52,3 +52,23 @@ config BTRFS_FS_CHECK_INTEGRITY
In most cases, unless you are a btrfs developer who needs In most cases, unless you are a btrfs developer who needs
to verify the integrity of (super)-block write requests to verify the integrity of (super)-block write requests
during the run of a regression test, say N during the run of a regression test, say N
config BTRFS_FS_RUN_SANITY_TESTS
bool "Btrfs will run sanity tests upon loading"
depends on BTRFS_FS
help
This will run some basic sanity tests on the free space cache
code to make sure it is acting as it should. These are mostly
regression tests and are only really interesting to btrfs devlopers.
If unsure, say N.
config BTRFS_DEBUG
bool "Btrfs debugging support"
depends on BTRFS_FS
help
Enable run-time debugging support for the btrfs filesystem. This may
enable additional and expensive checks with negative impact on
performance, or export extra information via sysfs.
If unsure, say N.
...@@ -352,6 +352,8 @@ static int __resolve_indirect_refs(struct btrfs_fs_info *fs_info, ...@@ -352,6 +352,8 @@ static int __resolve_indirect_refs(struct btrfs_fs_info *fs_info,
err = __resolve_indirect_ref(fs_info, search_commit_root, err = __resolve_indirect_ref(fs_info, search_commit_root,
time_seq, ref, parents, time_seq, ref, parents,
extent_item_pos); extent_item_pos);
if (err == -ENOMEM)
goto out;
if (err) if (err)
continue; continue;
...@@ -367,7 +369,7 @@ static int __resolve_indirect_refs(struct btrfs_fs_info *fs_info, ...@@ -367,7 +369,7 @@ static int __resolve_indirect_refs(struct btrfs_fs_info *fs_info,
new_ref = kmalloc(sizeof(*new_ref), GFP_NOFS); new_ref = kmalloc(sizeof(*new_ref), GFP_NOFS);
if (!new_ref) { if (!new_ref) {
ret = -ENOMEM; ret = -ENOMEM;
break; goto out;
} }
memcpy(new_ref, ref, sizeof(*ref)); memcpy(new_ref, ref, sizeof(*ref));
new_ref->parent = node->val; new_ref->parent = node->val;
...@@ -377,7 +379,7 @@ static int __resolve_indirect_refs(struct btrfs_fs_info *fs_info, ...@@ -377,7 +379,7 @@ static int __resolve_indirect_refs(struct btrfs_fs_info *fs_info,
} }
ulist_reinit(parents); ulist_reinit(parents);
} }
out:
ulist_free(parents); ulist_free(parents);
return ret; return ret;
} }
...@@ -421,7 +423,10 @@ static int __add_missing_keys(struct btrfs_fs_info *fs_info, ...@@ -421,7 +423,10 @@ static int __add_missing_keys(struct btrfs_fs_info *fs_info,
BUG_ON(!ref->wanted_disk_byte); BUG_ON(!ref->wanted_disk_byte);
eb = read_tree_block(fs_info->tree_root, ref->wanted_disk_byte, eb = read_tree_block(fs_info->tree_root, ref->wanted_disk_byte,
fs_info->tree_root->leafsize, 0); fs_info->tree_root->leafsize, 0);
BUG_ON(!eb); if (!eb || !extent_buffer_uptodate(eb)) {
free_extent_buffer(eb);
return -EIO;
}
btrfs_tree_read_lock(eb); btrfs_tree_read_lock(eb);
if (btrfs_header_level(eb) == 0) if (btrfs_header_level(eb) == 0)
btrfs_item_key_to_cpu(eb, &ref->key_for_search, 0); btrfs_item_key_to_cpu(eb, &ref->key_for_search, 0);
...@@ -443,7 +448,7 @@ static int __add_missing_keys(struct btrfs_fs_info *fs_info, ...@@ -443,7 +448,7 @@ static int __add_missing_keys(struct btrfs_fs_info *fs_info,
* having a parent). * having a parent).
* mode = 2: merge identical parents * mode = 2: merge identical parents
*/ */
static int __merge_refs(struct list_head *head, int mode) static void __merge_refs(struct list_head *head, int mode)
{ {
struct list_head *pos1; struct list_head *pos1;
...@@ -489,7 +494,6 @@ static int __merge_refs(struct list_head *head, int mode) ...@@ -489,7 +494,6 @@ static int __merge_refs(struct list_head *head, int mode)
} }
} }
return 0;
} }
/* /*
...@@ -582,7 +586,8 @@ static int __add_delayed_refs(struct btrfs_delayed_ref_head *head, u64 seq, ...@@ -582,7 +586,8 @@ static int __add_delayed_refs(struct btrfs_delayed_ref_head *head, u64 seq,
default: default:
WARN_ON(1); WARN_ON(1);
} }
BUG_ON(ret); if (ret)
return ret;
} }
return 0; return 0;
...@@ -680,7 +685,8 @@ static int __add_inline_refs(struct btrfs_fs_info *fs_info, ...@@ -680,7 +685,8 @@ static int __add_inline_refs(struct btrfs_fs_info *fs_info,
default: default:
WARN_ON(1); WARN_ON(1);
} }
BUG_ON(ret); if (ret)
return ret;
ptr += btrfs_extent_inline_ref_size(type); ptr += btrfs_extent_inline_ref_size(type);
} }
...@@ -762,7 +768,9 @@ static int __add_keyed_refs(struct btrfs_fs_info *fs_info, ...@@ -762,7 +768,9 @@ static int __add_keyed_refs(struct btrfs_fs_info *fs_info,
default: default:
WARN_ON(1); WARN_ON(1);
} }
BUG_ON(ret); if (ret)
return ret;
} }
return ret; return ret;
...@@ -880,18 +888,14 @@ static int find_parent_nodes(struct btrfs_trans_handle *trans, ...@@ -880,18 +888,14 @@ static int find_parent_nodes(struct btrfs_trans_handle *trans,
if (ret) if (ret)
goto out; goto out;
ret = __merge_refs(&prefs, 1); __merge_refs(&prefs, 1);
if (ret)
goto out;
ret = __resolve_indirect_refs(fs_info, search_commit_root, time_seq, ret = __resolve_indirect_refs(fs_info, search_commit_root, time_seq,
&prefs, extent_item_pos); &prefs, extent_item_pos);
if (ret) if (ret)
goto out; goto out;
ret = __merge_refs(&prefs, 2); __merge_refs(&prefs, 2);
if (ret)
goto out;
while (!list_empty(&prefs)) { while (!list_empty(&prefs)) {
ref = list_first_entry(&prefs, struct __prelim_ref, list); ref = list_first_entry(&prefs, struct __prelim_ref, list);
...@@ -900,7 +904,8 @@ static int find_parent_nodes(struct btrfs_trans_handle *trans, ...@@ -900,7 +904,8 @@ static int find_parent_nodes(struct btrfs_trans_handle *trans,
if (ref->count && ref->root_id && ref->parent == 0) { if (ref->count && ref->root_id && ref->parent == 0) {
/* no parent == root of tree */ /* no parent == root of tree */
ret = ulist_add(roots, ref->root_id, 0, GFP_NOFS); ret = ulist_add(roots, ref->root_id, 0, GFP_NOFS);
BUG_ON(ret < 0); if (ret < 0)
goto out;
} }
if (ref->count && ref->parent) { if (ref->count && ref->parent) {
struct extent_inode_elem *eie = NULL; struct extent_inode_elem *eie = NULL;
...@@ -911,7 +916,10 @@ static int find_parent_nodes(struct btrfs_trans_handle *trans, ...@@ -911,7 +916,10 @@ static int find_parent_nodes(struct btrfs_trans_handle *trans,
info_level); info_level);
eb = read_tree_block(fs_info->extent_root, eb = read_tree_block(fs_info->extent_root,
ref->parent, bsz, 0); ref->parent, bsz, 0);
BUG_ON(!eb); if (!eb || !extent_buffer_uptodate(eb)) {
free_extent_buffer(eb);
return -EIO;
}
ret = find_extent_in_eb(eb, bytenr, ret = find_extent_in_eb(eb, bytenr,
*extent_item_pos, &eie); *extent_item_pos, &eie);
ref->inode_list = eie; ref->inode_list = eie;
...@@ -920,6 +928,8 @@ static int find_parent_nodes(struct btrfs_trans_handle *trans, ...@@ -920,6 +928,8 @@ static int find_parent_nodes(struct btrfs_trans_handle *trans,
ret = ulist_add_merge(refs, ref->parent, ret = ulist_add_merge(refs, ref->parent,
(uintptr_t)ref->inode_list, (uintptr_t)ref->inode_list,
(u64 *)&eie, GFP_NOFS); (u64 *)&eie, GFP_NOFS);
if (ret < 0)
goto out;
if (!ret && extent_item_pos) { if (!ret && extent_item_pos) {
/* /*
* we've recorded that parent, so we must extend * we've recorded that parent, so we must extend
...@@ -930,7 +940,6 @@ static int find_parent_nodes(struct btrfs_trans_handle *trans, ...@@ -930,7 +940,6 @@ static int find_parent_nodes(struct btrfs_trans_handle *trans,
eie = eie->next; eie = eie->next;
eie->next = ref->inode_list; eie->next = ref->inode_list;
} }
BUG_ON(ret < 0);
} }
kfree(ref); kfree(ref);
} }
...@@ -1180,6 +1189,20 @@ int btrfs_find_one_extref(struct btrfs_root *root, u64 inode_objectid, ...@@ -1180,6 +1189,20 @@ int btrfs_find_one_extref(struct btrfs_root *root, u64 inode_objectid,
return ret; return ret;
} }
/*
* this iterates to turn a name (from iref/extref) into a full filesystem path.
* Elements of the path are separated by '/' and the path is guaranteed to be
* 0-terminated. the path is only given within the current file system.
* Therefore, it never starts with a '/'. the caller is responsible to provide
* "size" bytes in "dest". the dest buffer will be filled backwards. finally,
* the start point of the resulting string is returned. this pointer is within
* dest, normally.
* in case the path buffer would overflow, the pointer is decremented further
* as if output was written to the buffer, though no more output is actually
* generated. that way, the caller can determine how much space would be
* required for the path to fit into the buffer. in that case, the returned
* value will be smaller than dest. callers must check this!
*/
char *btrfs_ref_to_path(struct btrfs_root *fs_root, struct btrfs_path *path, char *btrfs_ref_to_path(struct btrfs_root *fs_root, struct btrfs_path *path,
u32 name_len, unsigned long name_off, u32 name_len, unsigned long name_off,
struct extent_buffer *eb_in, u64 parent, struct extent_buffer *eb_in, u64 parent,
...@@ -1248,32 +1271,6 @@ char *btrfs_ref_to_path(struct btrfs_root *fs_root, struct btrfs_path *path, ...@@ -1248,32 +1271,6 @@ char *btrfs_ref_to_path(struct btrfs_root *fs_root, struct btrfs_path *path,
return dest + bytes_left; return dest + bytes_left;
} }
/*
* this iterates to turn a btrfs_inode_ref into a full filesystem path. elements
* of the path are separated by '/' and the path is guaranteed to be
* 0-terminated. the path is only given within the current file system.
* Therefore, it never starts with a '/'. the caller is responsible to provide
* "size" bytes in "dest". the dest buffer will be filled backwards. finally,
* the start point of the resulting string is returned. this pointer is within
* dest, normally.
* in case the path buffer would overflow, the pointer is decremented further
* as if output was written to the buffer, though no more output is actually
* generated. that way, the caller can determine how much space would be
* required for the path to fit into the buffer. in that case, the returned
* value will be smaller than dest. callers must check this!
*/
char *btrfs_iref_to_path(struct btrfs_root *fs_root,
struct btrfs_path *path,
struct btrfs_inode_ref *iref,
struct extent_buffer *eb_in, u64 parent,
char *dest, u32 size)
{
return btrfs_ref_to_path(fs_root, path,
btrfs_inode_ref_name_len(eb_in, iref),
(unsigned long)(iref + 1),
eb_in, parent, dest, size);
}
/* /*
* this makes the path point to (logical EXTENT_ITEM *) * this makes the path point to (logical EXTENT_ITEM *)
* returns BTRFS_EXTENT_FLAG_DATA for data, BTRFS_EXTENT_FLAG_TREE_BLOCK for * returns BTRFS_EXTENT_FLAG_DATA for data, BTRFS_EXTENT_FLAG_TREE_BLOCK for
...@@ -1461,8 +1458,6 @@ int iterate_extent_inodes(struct btrfs_fs_info *fs_info, ...@@ -1461,8 +1458,6 @@ int iterate_extent_inodes(struct btrfs_fs_info *fs_info,
iterate_extent_inodes_t *iterate, void *ctx) iterate_extent_inodes_t *iterate, void *ctx)
{ {
int ret; int ret;
struct list_head data_refs = LIST_HEAD_INIT(data_refs);
struct list_head shared_refs = LIST_HEAD_INIT(shared_refs);
struct btrfs_trans_handle *trans; struct btrfs_trans_handle *trans;
struct ulist *refs = NULL; struct ulist *refs = NULL;
struct ulist *roots = NULL; struct ulist *roots = NULL;
...@@ -1508,11 +1503,9 @@ int iterate_extent_inodes(struct btrfs_fs_info *fs_info, ...@@ -1508,11 +1503,9 @@ int iterate_extent_inodes(struct btrfs_fs_info *fs_info,
iterate, ctx); iterate, ctx);
} }
ulist_free(roots); ulist_free(roots);
roots = NULL;
} }
free_leaf_list(refs); free_leaf_list(refs);
ulist_free(roots);
out: out:
if (!search_commit_root) { if (!search_commit_root) {
btrfs_put_tree_mod_seq(fs_info, &tree_mod_seq_elem); btrfs_put_tree_mod_seq(fs_info, &tree_mod_seq_elem);
......
...@@ -59,9 +59,6 @@ int paths_from_inode(u64 inum, struct inode_fs_paths *ipath); ...@@ -59,9 +59,6 @@ int paths_from_inode(u64 inum, struct inode_fs_paths *ipath);
int btrfs_find_all_roots(struct btrfs_trans_handle *trans, int btrfs_find_all_roots(struct btrfs_trans_handle *trans,
struct btrfs_fs_info *fs_info, u64 bytenr, struct btrfs_fs_info *fs_info, u64 bytenr,
u64 time_seq, struct ulist **roots); u64 time_seq, struct ulist **roots);
char *btrfs_iref_to_path(struct btrfs_root *fs_root, struct btrfs_path *path,
struct btrfs_inode_ref *iref, struct extent_buffer *eb,
u64 parent, char *dest, u32 size);
char *btrfs_ref_to_path(struct btrfs_root *fs_root, struct btrfs_path *path, char *btrfs_ref_to_path(struct btrfs_root *fs_root, struct btrfs_path *path,
u32 name_len, unsigned long name_off, u32 name_len, unsigned long name_off,
struct extent_buffer *eb_in, u64 parent, struct extent_buffer *eb_in, u64 parent,
......
...@@ -93,7 +93,7 @@ struct btrfs_inode { ...@@ -93,7 +93,7 @@ struct btrfs_inode {
unsigned long runtime_flags; unsigned long runtime_flags;
/* Keep track of who's O_SYNC/fsycing currently */ /* Keep track of who's O_SYNC/fsyncing currently */
atomic_t sync_writers; atomic_t sync_writers;
/* full 64 bit generation number, struct vfs_inode doesn't have a big /* full 64 bit generation number, struct vfs_inode doesn't have a big
......
...@@ -82,6 +82,10 @@ struct compressed_bio { ...@@ -82,6 +82,10 @@ struct compressed_bio {
u32 sums; u32 sums;
}; };
static int btrfs_decompress_biovec(int type, struct page **pages_in,
u64 disk_start, struct bio_vec *bvec,
int vcnt, size_t srclen);
static inline int compressed_bio_size(struct btrfs_root *root, static inline int compressed_bio_size(struct btrfs_root *root,
unsigned long disk_size) unsigned long disk_size)
{ {
...@@ -106,7 +110,6 @@ static int check_compressed_csum(struct inode *inode, ...@@ -106,7 +110,6 @@ static int check_compressed_csum(struct inode *inode,
u64 disk_start) u64 disk_start)
{ {
int ret; int ret;
struct btrfs_root *root = BTRFS_I(inode)->root;
struct page *page; struct page *page;
unsigned long i; unsigned long i;
char *kaddr; char *kaddr;
...@@ -121,7 +124,7 @@ static int check_compressed_csum(struct inode *inode, ...@@ -121,7 +124,7 @@ static int check_compressed_csum(struct inode *inode,
csum = ~(u32)0; csum = ~(u32)0;
kaddr = kmap_atomic(page); kaddr = kmap_atomic(page);
csum = btrfs_csum_data(root, kaddr, csum, PAGE_CACHE_SIZE); csum = btrfs_csum_data(kaddr, csum, PAGE_CACHE_SIZE);
btrfs_csum_final(csum, (char *)&csum); btrfs_csum_final(csum, (char *)&csum);
kunmap_atomic(kaddr); kunmap_atomic(kaddr);
...@@ -739,7 +742,7 @@ static int comp_num_workspace[BTRFS_COMPRESS_TYPES]; ...@@ -739,7 +742,7 @@ static int comp_num_workspace[BTRFS_COMPRESS_TYPES];
static atomic_t comp_alloc_workspace[BTRFS_COMPRESS_TYPES]; static atomic_t comp_alloc_workspace[BTRFS_COMPRESS_TYPES];
static wait_queue_head_t comp_workspace_wait[BTRFS_COMPRESS_TYPES]; static wait_queue_head_t comp_workspace_wait[BTRFS_COMPRESS_TYPES];
struct btrfs_compress_op *btrfs_compress_op[] = { static struct btrfs_compress_op *btrfs_compress_op[] = {
&btrfs_zlib_compress, &btrfs_zlib_compress,
&btrfs_lzo_compress, &btrfs_lzo_compress,
}; };
...@@ -910,8 +913,9 @@ int btrfs_compress_pages(int type, struct address_space *mapping, ...@@ -910,8 +913,9 @@ int btrfs_compress_pages(int type, struct address_space *mapping,
* be contiguous. They all correspond to the range of bytes covered by * be contiguous. They all correspond to the range of bytes covered by
* the compressed extent. * the compressed extent.
*/ */
int btrfs_decompress_biovec(int type, struct page **pages_in, u64 disk_start, static int btrfs_decompress_biovec(int type, struct page **pages_in,
struct bio_vec *bvec, int vcnt, size_t srclen) u64 disk_start, struct bio_vec *bvec,
int vcnt, size_t srclen)
{ {
struct list_head *workspace; struct list_head *workspace;
int ret; int ret;
......
...@@ -30,8 +30,6 @@ int btrfs_compress_pages(int type, struct address_space *mapping, ...@@ -30,8 +30,6 @@ int btrfs_compress_pages(int type, struct address_space *mapping,
unsigned long *total_in, unsigned long *total_in,
unsigned long *total_out, unsigned long *total_out,
unsigned long max_out); unsigned long max_out);
int btrfs_decompress_biovec(int type, struct page **pages_in, u64 disk_start,
struct bio_vec *bvec, int vcnt, size_t srclen);
int btrfs_decompress(int type, unsigned char *data_in, struct page *dest_page, int btrfs_decompress(int type, unsigned char *data_in, struct page *dest_page,
unsigned long start_byte, size_t srclen, size_t destlen); unsigned long start_byte, size_t srclen, size_t destlen);
int btrfs_decompress_buf2page(char *buf, unsigned long buf_start, int btrfs_decompress_buf2page(char *buf, unsigned long buf_start,
......
This diff is collapsed.
This diff is collapsed.
...@@ -202,7 +202,7 @@ static void btrfs_dequeue_delayed_node(struct btrfs_delayed_root *root, ...@@ -202,7 +202,7 @@ static void btrfs_dequeue_delayed_node(struct btrfs_delayed_root *root,
spin_unlock(&root->lock); spin_unlock(&root->lock);
} }
struct btrfs_delayed_node *btrfs_first_delayed_node( static struct btrfs_delayed_node *btrfs_first_delayed_node(
struct btrfs_delayed_root *delayed_root) struct btrfs_delayed_root *delayed_root)
{ {
struct list_head *p; struct list_head *p;
...@@ -221,7 +221,7 @@ struct btrfs_delayed_node *btrfs_first_delayed_node( ...@@ -221,7 +221,7 @@ struct btrfs_delayed_node *btrfs_first_delayed_node(
return node; return node;
} }
struct btrfs_delayed_node *btrfs_next_delayed_node( static struct btrfs_delayed_node *btrfs_next_delayed_node(
struct btrfs_delayed_node *node) struct btrfs_delayed_node *node)
{ {
struct btrfs_delayed_root *delayed_root; struct btrfs_delayed_root *delayed_root;
...@@ -282,7 +282,7 @@ static inline void btrfs_release_delayed_node(struct btrfs_delayed_node *node) ...@@ -282,7 +282,7 @@ static inline void btrfs_release_delayed_node(struct btrfs_delayed_node *node)
__btrfs_release_delayed_node(node, 0); __btrfs_release_delayed_node(node, 0);
} }
struct btrfs_delayed_node *btrfs_first_prepared_delayed_node( static struct btrfs_delayed_node *btrfs_first_prepared_delayed_node(
struct btrfs_delayed_root *delayed_root) struct btrfs_delayed_root *delayed_root)
{ {
struct list_head *p; struct list_head *p;
...@@ -308,7 +308,7 @@ static inline void btrfs_release_prepared_delayed_node( ...@@ -308,7 +308,7 @@ static inline void btrfs_release_prepared_delayed_node(
__btrfs_release_delayed_node(node, 1); __btrfs_release_delayed_node(node, 1);
} }
struct btrfs_delayed_item *btrfs_alloc_delayed_item(u32 data_len) static struct btrfs_delayed_item *btrfs_alloc_delayed_item(u32 data_len)
{ {
struct btrfs_delayed_item *item; struct btrfs_delayed_item *item;
item = kmalloc(sizeof(*item) + data_len, GFP_NOFS); item = kmalloc(sizeof(*item) + data_len, GFP_NOFS);
...@@ -383,7 +383,7 @@ static struct btrfs_delayed_item *__btrfs_lookup_delayed_item( ...@@ -383,7 +383,7 @@ static struct btrfs_delayed_item *__btrfs_lookup_delayed_item(
return NULL; return NULL;
} }
struct btrfs_delayed_item *__btrfs_lookup_delayed_insertion_item( static struct btrfs_delayed_item *__btrfs_lookup_delayed_insertion_item(
struct btrfs_delayed_node *delayed_node, struct btrfs_delayed_node *delayed_node,
struct btrfs_key *key) struct btrfs_key *key)
{ {
...@@ -394,45 +394,6 @@ struct btrfs_delayed_item *__btrfs_lookup_delayed_insertion_item( ...@@ -394,45 +394,6 @@ struct btrfs_delayed_item *__btrfs_lookup_delayed_insertion_item(
return item; return item;
} }
struct btrfs_delayed_item *__btrfs_lookup_delayed_deletion_item(
struct btrfs_delayed_node *delayed_node,
struct btrfs_key *key)
{
struct btrfs_delayed_item *item;
item = __btrfs_lookup_delayed_item(&delayed_node->del_root, key,
NULL, NULL);
return item;
}
struct btrfs_delayed_item *__btrfs_search_delayed_insertion_item(
struct btrfs_delayed_node *delayed_node,
struct btrfs_key *key)
{
struct btrfs_delayed_item *item, *next;
item = __btrfs_lookup_delayed_item(&delayed_node->ins_root, key,
NULL, &next);
if (!item)
item = next;
return item;
}
struct btrfs_delayed_item *__btrfs_search_delayed_deletion_item(
struct btrfs_delayed_node *delayed_node,
struct btrfs_key *key)
{
struct btrfs_delayed_item *item, *next;
item = __btrfs_lookup_delayed_item(&delayed_node->del_root, key,
NULL, &next);
if (!item)
item = next;
return item;
}
static int __btrfs_add_delayed_item(struct btrfs_delayed_node *delayed_node, static int __btrfs_add_delayed_item(struct btrfs_delayed_node *delayed_node,
struct btrfs_delayed_item *ins, struct btrfs_delayed_item *ins,
int action) int action)
...@@ -535,7 +496,7 @@ static void btrfs_release_delayed_item(struct btrfs_delayed_item *item) ...@@ -535,7 +496,7 @@ static void btrfs_release_delayed_item(struct btrfs_delayed_item *item)
} }
} }
struct btrfs_delayed_item *__btrfs_first_delayed_insertion_item( static struct btrfs_delayed_item *__btrfs_first_delayed_insertion_item(
struct btrfs_delayed_node *delayed_node) struct btrfs_delayed_node *delayed_node)
{ {
struct rb_node *p; struct rb_node *p;
...@@ -548,7 +509,7 @@ struct btrfs_delayed_item *__btrfs_first_delayed_insertion_item( ...@@ -548,7 +509,7 @@ struct btrfs_delayed_item *__btrfs_first_delayed_insertion_item(
return item; return item;
} }
struct btrfs_delayed_item *__btrfs_first_delayed_deletion_item( static struct btrfs_delayed_item *__btrfs_first_delayed_deletion_item(
struct btrfs_delayed_node *delayed_node) struct btrfs_delayed_node *delayed_node)
{ {
struct rb_node *p; struct rb_node *p;
...@@ -561,7 +522,7 @@ struct btrfs_delayed_item *__btrfs_first_delayed_deletion_item( ...@@ -561,7 +522,7 @@ struct btrfs_delayed_item *__btrfs_first_delayed_deletion_item(
return item; return item;
} }
struct btrfs_delayed_item *__btrfs_next_delayed_item( static struct btrfs_delayed_item *__btrfs_next_delayed_item(
struct btrfs_delayed_item *item) struct btrfs_delayed_item *item)
{ {
struct rb_node *p; struct rb_node *p;
...@@ -766,8 +727,7 @@ static void btrfs_delayed_inode_release_metadata(struct btrfs_root *root, ...@@ -766,8 +727,7 @@ static void btrfs_delayed_inode_release_metadata(struct btrfs_root *root,
* This helper will insert some continuous items into the same leaf according * This helper will insert some continuous items into the same leaf according
* to the free space of the leaf. * to the free space of the leaf.
*/ */
static int btrfs_batch_insert_items(struct btrfs_trans_handle *trans, static int btrfs_batch_insert_items(struct btrfs_root *root,
struct btrfs_root *root,
struct btrfs_path *path, struct btrfs_path *path,
struct btrfs_delayed_item *item) struct btrfs_delayed_item *item)
{ {
...@@ -848,7 +808,7 @@ static int btrfs_batch_insert_items(struct btrfs_trans_handle *trans, ...@@ -848,7 +808,7 @@ static int btrfs_batch_insert_items(struct btrfs_trans_handle *trans,
btrfs_clear_path_blocking(path, NULL, 0); btrfs_clear_path_blocking(path, NULL, 0);
/* insert the keys of the items */ /* insert the keys of the items */
setup_items_for_insert(trans, root, path, keys, data_size, setup_items_for_insert(root, path, keys, data_size,
total_data_size, total_size, nitems); total_data_size, total_size, nitems);
/* insert the dir index items */ /* insert the dir index items */
...@@ -932,7 +892,7 @@ static int btrfs_insert_delayed_items(struct btrfs_trans_handle *trans, ...@@ -932,7 +892,7 @@ static int btrfs_insert_delayed_items(struct btrfs_trans_handle *trans,
if (curr && btrfs_is_continuous_delayed_item(prev, curr)) { if (curr && btrfs_is_continuous_delayed_item(prev, curr)) {
/* insert the continuous items into the same leaf */ /* insert the continuous items into the same leaf */
path->slots[0]++; path->slots[0]++;
btrfs_batch_insert_items(trans, root, path, curr); btrfs_batch_insert_items(root, path, curr);
} }
btrfs_release_delayed_item(prev); btrfs_release_delayed_item(prev);
btrfs_mark_buffer_dirty(path->nodes[0]); btrfs_mark_buffer_dirty(path->nodes[0]);
......
...@@ -40,16 +40,19 @@ struct kmem_cache *btrfs_delayed_extent_op_cachep; ...@@ -40,16 +40,19 @@ struct kmem_cache *btrfs_delayed_extent_op_cachep;
* compare two delayed tree backrefs with same bytenr and type * compare two delayed tree backrefs with same bytenr and type
*/ */
static int comp_tree_refs(struct btrfs_delayed_tree_ref *ref2, static int comp_tree_refs(struct btrfs_delayed_tree_ref *ref2,
struct btrfs_delayed_tree_ref *ref1) struct btrfs_delayed_tree_ref *ref1, int type)
{ {
if (type == BTRFS_TREE_BLOCK_REF_KEY) {
if (ref1->root < ref2->root) if (ref1->root < ref2->root)
return -1; return -1;
if (ref1->root > ref2->root) if (ref1->root > ref2->root)
return 1; return 1;
} else {
if (ref1->parent < ref2->parent) if (ref1->parent < ref2->parent)
return -1; return -1;
if (ref1->parent > ref2->parent) if (ref1->parent > ref2->parent)
return 1; return 1;
}
return 0; return 0;
} }
...@@ -113,7 +116,8 @@ static int comp_entry(struct btrfs_delayed_ref_node *ref2, ...@@ -113,7 +116,8 @@ static int comp_entry(struct btrfs_delayed_ref_node *ref2,
if (ref1->type == BTRFS_TREE_BLOCK_REF_KEY || if (ref1->type == BTRFS_TREE_BLOCK_REF_KEY ||
ref1->type == BTRFS_SHARED_BLOCK_REF_KEY) { ref1->type == BTRFS_SHARED_BLOCK_REF_KEY) {
return comp_tree_refs(btrfs_delayed_node_to_tree_ref(ref2), return comp_tree_refs(btrfs_delayed_node_to_tree_ref(ref2),
btrfs_delayed_node_to_tree_ref(ref1)); btrfs_delayed_node_to_tree_ref(ref1),
ref1->type);
} else if (ref1->type == BTRFS_EXTENT_DATA_REF_KEY || } else if (ref1->type == BTRFS_EXTENT_DATA_REF_KEY ||
ref1->type == BTRFS_SHARED_DATA_REF_KEY) { ref1->type == BTRFS_SHARED_DATA_REF_KEY) {
return comp_data_refs(btrfs_delayed_node_to_data_ref(ref2), return comp_data_refs(btrfs_delayed_node_to_data_ref(ref2),
...@@ -357,8 +361,10 @@ int btrfs_check_delayed_seq(struct btrfs_fs_info *fs_info, ...@@ -357,8 +361,10 @@ int btrfs_check_delayed_seq(struct btrfs_fs_info *fs_info,
elem = list_first_entry(&fs_info->tree_mod_seq_list, elem = list_first_entry(&fs_info->tree_mod_seq_list,
struct seq_list, list); struct seq_list, list);
if (seq >= elem->seq) { if (seq >= elem->seq) {
pr_debug("holding back delayed_ref %llu, lowest is " pr_debug("holding back delayed_ref %#x.%x, lowest is %#x.%x (%p)\n",
"%llu (%p)\n", seq, elem->seq, delayed_refs); (u32)(seq >> 32), (u32)seq,
(u32)(elem->seq >> 32), (u32)elem->seq,
delayed_refs);
ret = 1; ret = 1;
} }
} }
......
...@@ -21,6 +21,10 @@ ...@@ -21,6 +21,10 @@
#include "hash.h" #include "hash.h"
#include "transaction.h" #include "transaction.h"
static struct btrfs_dir_item *btrfs_match_dir_item_name(struct btrfs_root *root,
struct btrfs_path *path,
const char *name, int name_len);
/* /*
* insert a name into a directory, doing overflow properly if there is a hash * insert a name into a directory, doing overflow properly if there is a hash
* collision. data_size indicates how big the item inserted should be. On * collision. data_size indicates how big the item inserted should be. On
...@@ -49,7 +53,7 @@ static struct btrfs_dir_item *insert_with_overflow(struct btrfs_trans_handle ...@@ -49,7 +53,7 @@ static struct btrfs_dir_item *insert_with_overflow(struct btrfs_trans_handle
di = btrfs_match_dir_item_name(root, path, name, name_len); di = btrfs_match_dir_item_name(root, path, name, name_len);
if (di) if (di)
return ERR_PTR(-EEXIST); return ERR_PTR(-EEXIST);
btrfs_extend_item(trans, root, path, data_size); btrfs_extend_item(root, path, data_size);
} else if (ret < 0) } else if (ret < 0)
return ERR_PTR(ret); return ERR_PTR(ret);
WARN_ON(ret > 0); WARN_ON(ret > 0);
...@@ -379,7 +383,7 @@ struct btrfs_dir_item *btrfs_lookup_xattr(struct btrfs_trans_handle *trans, ...@@ -379,7 +383,7 @@ struct btrfs_dir_item *btrfs_lookup_xattr(struct btrfs_trans_handle *trans,
* this walks through all the entries in a dir item and finds one * this walks through all the entries in a dir item and finds one
* for a specific name. * for a specific name.
*/ */
struct btrfs_dir_item *btrfs_match_dir_item_name(struct btrfs_root *root, static struct btrfs_dir_item *btrfs_match_dir_item_name(struct btrfs_root *root,
struct btrfs_path *path, struct btrfs_path *path,
const char *name, int name_len) const char *name, int name_len)
{ {
...@@ -442,8 +446,7 @@ int btrfs_delete_one_dir_name(struct btrfs_trans_handle *trans, ...@@ -442,8 +446,7 @@ int btrfs_delete_one_dir_name(struct btrfs_trans_handle *trans,
start = btrfs_item_ptr_offset(leaf, path->slots[0]); start = btrfs_item_ptr_offset(leaf, path->slots[0]);
memmove_extent_buffer(leaf, ptr, ptr + sub_item_len, memmove_extent_buffer(leaf, ptr, ptr + sub_item_len,
item_len - (ptr + sub_item_len - start)); item_len - (ptr + sub_item_len - start));
btrfs_truncate_item(trans, root, path, btrfs_truncate_item(root, path, item_len - sub_item_len, 1);
item_len - sub_item_len, 1);
} }
return ret; return ret;
} }
......
This diff is collapsed.
...@@ -61,7 +61,6 @@ int write_ctree_super(struct btrfs_trans_handle *trans, ...@@ -61,7 +61,6 @@ int write_ctree_super(struct btrfs_trans_handle *trans,
struct btrfs_root *root, int max_mirrors); struct btrfs_root *root, int max_mirrors);
struct buffer_head *btrfs_read_dev_super(struct block_device *bdev); struct buffer_head *btrfs_read_dev_super(struct block_device *bdev);
int btrfs_commit_super(struct btrfs_root *root); int btrfs_commit_super(struct btrfs_root *root);
void btrfs_error_commit_super(struct btrfs_root *root);
struct extent_buffer *btrfs_find_tree_block(struct btrfs_root *root, struct extent_buffer *btrfs_find_tree_block(struct btrfs_root *root,
u64 bytenr, u32 blocksize); u64 bytenr, u32 blocksize);
struct btrfs_root *btrfs_read_fs_root_no_radix(struct btrfs_root *tree_root, struct btrfs_root *btrfs_read_fs_root_no_radix(struct btrfs_root *tree_root,
...@@ -77,7 +76,7 @@ int btrfs_buffer_uptodate(struct extent_buffer *buf, u64 parent_transid, ...@@ -77,7 +76,7 @@ int btrfs_buffer_uptodate(struct extent_buffer *buf, u64 parent_transid,
int atomic); int atomic);
int btrfs_set_buffer_uptodate(struct extent_buffer *buf); int btrfs_set_buffer_uptodate(struct extent_buffer *buf);
int btrfs_read_buffer(struct extent_buffer *buf, u64 parent_transid); int btrfs_read_buffer(struct extent_buffer *buf, u64 parent_transid);
u32 btrfs_csum_data(struct btrfs_root *root, char *data, u32 seed, size_t len); u32 btrfs_csum_data(char *data, u32 seed, size_t len);
void btrfs_csum_final(u32 crc, char *result); void btrfs_csum_final(u32 crc, char *result);
int btrfs_bio_wq_end_io(struct btrfs_fs_info *info, struct bio *bio, int btrfs_bio_wq_end_io(struct btrfs_fs_info *info, struct bio *bio,
int metadata); int metadata);
...@@ -93,10 +92,8 @@ int btrfs_init_log_root_tree(struct btrfs_trans_handle *trans, ...@@ -93,10 +92,8 @@ int btrfs_init_log_root_tree(struct btrfs_trans_handle *trans,
struct btrfs_fs_info *fs_info); struct btrfs_fs_info *fs_info);
int btrfs_add_log_tree(struct btrfs_trans_handle *trans, int btrfs_add_log_tree(struct btrfs_trans_handle *trans,
struct btrfs_root *root); struct btrfs_root *root);
int btrfs_cleanup_transaction(struct btrfs_root *root);
void btrfs_cleanup_one_transaction(struct btrfs_transaction *trans, void btrfs_cleanup_one_transaction(struct btrfs_transaction *trans,
struct btrfs_root *root); struct btrfs_root *root);
void btrfs_abort_devices(struct btrfs_root *root);
struct btrfs_root *btrfs_create_tree(struct btrfs_trans_handle *trans, struct btrfs_root *btrfs_create_tree(struct btrfs_trans_handle *trans,
struct btrfs_fs_info *fs_info, struct btrfs_fs_info *fs_info,
u64 objectid); u64 objectid);
......
This diff is collapsed.
This diff is collapsed.
...@@ -81,9 +81,9 @@ struct extent_io_ops { ...@@ -81,9 +81,9 @@ struct extent_io_ops {
int (*writepage_end_io_hook)(struct page *page, u64 start, u64 end, int (*writepage_end_io_hook)(struct page *page, u64 start, u64 end,
struct extent_state *state, int uptodate); struct extent_state *state, int uptodate);
void (*set_bit_hook)(struct inode *inode, struct extent_state *state, void (*set_bit_hook)(struct inode *inode, struct extent_state *state,
int *bits); unsigned long *bits);
void (*clear_bit_hook)(struct inode *inode, struct extent_state *state, void (*clear_bit_hook)(struct inode *inode, struct extent_state *state,
int *bits); unsigned long *bits);
void (*merge_extent_hook)(struct inode *inode, void (*merge_extent_hook)(struct inode *inode,
struct extent_state *new, struct extent_state *new,
struct extent_state *other); struct extent_state *other);
...@@ -116,7 +116,9 @@ struct extent_state { ...@@ -116,7 +116,9 @@ struct extent_state {
/* for use by the FS */ /* for use by the FS */
u64 private; u64 private;
#ifdef CONFIG_BTRFS_DEBUG
struct list_head leak_list; struct list_head leak_list;
#endif
}; };
#define INLINE_EXTENT_BUFFER_PAGES 16 #define INLINE_EXTENT_BUFFER_PAGES 16
...@@ -132,7 +134,6 @@ struct extent_buffer { ...@@ -132,7 +134,6 @@ struct extent_buffer {
atomic_t refs; atomic_t refs;
atomic_t io_pages; atomic_t io_pages;
int read_mirror; int read_mirror;
struct list_head leak_list;
struct rcu_head rcu_head; struct rcu_head rcu_head;
pid_t lock_owner; pid_t lock_owner;
...@@ -159,6 +160,9 @@ struct extent_buffer { ...@@ -159,6 +160,9 @@ struct extent_buffer {
wait_queue_head_t read_lock_wq; wait_queue_head_t read_lock_wq;
wait_queue_head_t lock_wq; wait_queue_head_t lock_wq;
struct page *pages[INLINE_EXTENT_BUFFER_PAGES]; struct page *pages[INLINE_EXTENT_BUFFER_PAGES];
#ifdef CONFIG_BTRFS_DEBUG
struct list_head leak_list;
#endif
}; };
static inline void extent_set_compress_type(unsigned long *bio_flags, static inline void extent_set_compress_type(unsigned long *bio_flags,
...@@ -185,13 +189,10 @@ void extent_io_tree_init(struct extent_io_tree *tree, ...@@ -185,13 +189,10 @@ void extent_io_tree_init(struct extent_io_tree *tree,
int try_release_extent_mapping(struct extent_map_tree *map, int try_release_extent_mapping(struct extent_map_tree *map,
struct extent_io_tree *tree, struct page *page, struct extent_io_tree *tree, struct page *page,
gfp_t mask); gfp_t mask);
int try_release_extent_buffer(struct page *page, gfp_t mask); int try_release_extent_buffer(struct page *page);
int try_release_extent_state(struct extent_map_tree *map,
struct extent_io_tree *tree, struct page *page,
gfp_t mask);
int lock_extent(struct extent_io_tree *tree, u64 start, u64 end); int lock_extent(struct extent_io_tree *tree, u64 start, u64 end);
int lock_extent_bits(struct extent_io_tree *tree, u64 start, u64 end, int lock_extent_bits(struct extent_io_tree *tree, u64 start, u64 end,
int bits, struct extent_state **cached); unsigned long bits, struct extent_state **cached);
int unlock_extent(struct extent_io_tree *tree, u64 start, u64 end); int unlock_extent(struct extent_io_tree *tree, u64 start, u64 end);
int unlock_extent_cached(struct extent_io_tree *tree, u64 start, u64 end, int unlock_extent_cached(struct extent_io_tree *tree, u64 start, u64 end,
struct extent_state **cached, gfp_t mask); struct extent_state **cached, gfp_t mask);
...@@ -207,16 +208,17 @@ u64 count_range_bits(struct extent_io_tree *tree, ...@@ -207,16 +208,17 @@ u64 count_range_bits(struct extent_io_tree *tree,
void free_extent_state(struct extent_state *state); void free_extent_state(struct extent_state *state);
int test_range_bit(struct extent_io_tree *tree, u64 start, u64 end, int test_range_bit(struct extent_io_tree *tree, u64 start, u64 end,
int bits, int filled, struct extent_state *cached_state); unsigned long bits, int filled,
struct extent_state *cached_state);
int clear_extent_bits(struct extent_io_tree *tree, u64 start, u64 end, int clear_extent_bits(struct extent_io_tree *tree, u64 start, u64 end,
int bits, gfp_t mask); unsigned long bits, gfp_t mask);
int clear_extent_bit(struct extent_io_tree *tree, u64 start, u64 end, int clear_extent_bit(struct extent_io_tree *tree, u64 start, u64 end,
int bits, int wake, int delete, struct extent_state **cached, unsigned long bits, int wake, int delete,
gfp_t mask); struct extent_state **cached, gfp_t mask);
int set_extent_bits(struct extent_io_tree *tree, u64 start, u64 end, int set_extent_bits(struct extent_io_tree *tree, u64 start, u64 end,
int bits, gfp_t mask); unsigned long bits, gfp_t mask);
int set_extent_bit(struct extent_io_tree *tree, u64 start, u64 end, int set_extent_bit(struct extent_io_tree *tree, u64 start, u64 end,
int bits, u64 *failed_start, unsigned long bits, u64 *failed_start,
struct extent_state **cached_state, gfp_t mask); struct extent_state **cached_state, gfp_t mask);
int set_extent_uptodate(struct extent_io_tree *tree, u64 start, u64 end, int set_extent_uptodate(struct extent_io_tree *tree, u64 start, u64 end,
struct extent_state **cached_state, gfp_t mask); struct extent_state **cached_state, gfp_t mask);
...@@ -229,17 +231,15 @@ int set_extent_dirty(struct extent_io_tree *tree, u64 start, u64 end, ...@@ -229,17 +231,15 @@ int set_extent_dirty(struct extent_io_tree *tree, u64 start, u64 end,
int clear_extent_dirty(struct extent_io_tree *tree, u64 start, u64 end, int clear_extent_dirty(struct extent_io_tree *tree, u64 start, u64 end,
gfp_t mask); gfp_t mask);
int convert_extent_bit(struct extent_io_tree *tree, u64 start, u64 end, int convert_extent_bit(struct extent_io_tree *tree, u64 start, u64 end,
int bits, int clear_bits, unsigned long bits, unsigned long clear_bits,
struct extent_state **cached_state, gfp_t mask); struct extent_state **cached_state, gfp_t mask);
int set_extent_delalloc(struct extent_io_tree *tree, u64 start, u64 end, int set_extent_delalloc(struct extent_io_tree *tree, u64 start, u64 end,
struct extent_state **cached_state, gfp_t mask); struct extent_state **cached_state, gfp_t mask);
int set_extent_defrag(struct extent_io_tree *tree, u64 start, u64 end, int set_extent_defrag(struct extent_io_tree *tree, u64 start, u64 end,
struct extent_state **cached_state, gfp_t mask); struct extent_state **cached_state, gfp_t mask);
int find_first_extent_bit(struct extent_io_tree *tree, u64 start, int find_first_extent_bit(struct extent_io_tree *tree, u64 start,
u64 *start_ret, u64 *end_ret, int bits, u64 *start_ret, u64 *end_ret, unsigned long bits,
struct extent_state **cached_state); struct extent_state **cached_state);
struct extent_state *find_first_extent_bit_state(struct extent_io_tree *tree,
u64 start, int bits);
int extent_invalidatepage(struct extent_io_tree *tree, int extent_invalidatepage(struct extent_io_tree *tree,
struct page *page, unsigned long offset); struct page *page, unsigned long offset);
int extent_write_full_page(struct extent_io_tree *tree, struct page *page, int extent_write_full_page(struct extent_io_tree *tree, struct page *page,
...@@ -261,6 +261,10 @@ int extent_readpages(struct extent_io_tree *tree, ...@@ -261,6 +261,10 @@ int extent_readpages(struct extent_io_tree *tree,
int extent_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, int extent_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
__u64 start, __u64 len, get_extent_t *get_extent); __u64 start, __u64 len, get_extent_t *get_extent);
int set_state_private(struct extent_io_tree *tree, u64 start, u64 private); int set_state_private(struct extent_io_tree *tree, u64 start, u64 private);
void extent_cache_csums_dio(struct extent_io_tree *tree, u64 start, u32 csums[],
int count);
void extent_cache_csums(struct extent_io_tree *tree, struct bio *bio,
int bvec_index, u32 csums[], int count);
int get_state_private(struct extent_io_tree *tree, u64 start, u64 *private); int get_state_private(struct extent_io_tree *tree, u64 start, u64 *private);
void set_page_extent_mapped(struct page *page); void set_page_extent_mapped(struct page *page);
...@@ -278,6 +282,7 @@ void free_extent_buffer_stale(struct extent_buffer *eb); ...@@ -278,6 +282,7 @@ void free_extent_buffer_stale(struct extent_buffer *eb);
int read_extent_buffer_pages(struct extent_io_tree *tree, int read_extent_buffer_pages(struct extent_io_tree *tree,
struct extent_buffer *eb, u64 start, int wait, struct extent_buffer *eb, u64 start, int wait,
get_extent_t *get_extent, int mirror_num); get_extent_t *get_extent, int mirror_num);
void wait_on_extent_buffer_writeback(struct extent_buffer *eb);
static inline unsigned long num_extent_pages(u64 start, u64 len) static inline unsigned long num_extent_pages(u64 start, u64 len)
{ {
...@@ -313,7 +318,6 @@ void memmove_extent_buffer(struct extent_buffer *dst, unsigned long dst_offset, ...@@ -313,7 +318,6 @@ void memmove_extent_buffer(struct extent_buffer *dst, unsigned long dst_offset,
unsigned long src_offset, unsigned long len); unsigned long src_offset, unsigned long len);
void memset_extent_buffer(struct extent_buffer *eb, char c, void memset_extent_buffer(struct extent_buffer *eb, char c,
unsigned long start, unsigned long len); unsigned long start, unsigned long len);
void wait_extent_bit(struct extent_io_tree *tree, u64 start, u64 end, int bits);
void clear_extent_buffer_dirty(struct extent_buffer *eb); void clear_extent_buffer_dirty(struct extent_buffer *eb);
int set_extent_buffer_dirty(struct extent_buffer *eb); int set_extent_buffer_dirty(struct extent_buffer *eb);
int set_extent_buffer_uptodate(struct extent_buffer *eb); int set_extent_buffer_uptodate(struct extent_buffer *eb);
...@@ -323,8 +327,6 @@ int map_private_extent_buffer(struct extent_buffer *eb, unsigned long offset, ...@@ -323,8 +327,6 @@ int map_private_extent_buffer(struct extent_buffer *eb, unsigned long offset,
unsigned long min_len, char **map, unsigned long min_len, char **map,
unsigned long *map_start, unsigned long *map_start,
unsigned long *map_len); unsigned long *map_len);
int extent_range_uptodate(struct extent_io_tree *tree,
u64 start, u64 end);
int extent_range_clear_dirty_for_io(struct inode *inode, u64 start, u64 end); int extent_range_clear_dirty_for_io(struct inode *inode, u64 start, u64 end);
int extent_range_redirty_for_io(struct inode *inode, u64 start, u64 end); int extent_range_redirty_for_io(struct inode *inode, u64 start, u64 end);
int extent_clear_unlock_delalloc(struct inode *inode, int extent_clear_unlock_delalloc(struct inode *inode,
......
...@@ -174,6 +174,14 @@ static int mergable_maps(struct extent_map *prev, struct extent_map *next) ...@@ -174,6 +174,14 @@ static int mergable_maps(struct extent_map *prev, struct extent_map *next)
test_bit(EXTENT_FLAG_LOGGING, &next->flags)) test_bit(EXTENT_FLAG_LOGGING, &next->flags))
return 0; return 0;
/*
* We don't want to merge stuff that hasn't been written to the log yet
* since it may not reflect exactly what is on disk, and that would be
* bad.
*/
if (!list_empty(&prev->list) || !list_empty(&next->list))
return 0;
if (extent_map_end(prev) == next->start && if (extent_map_end(prev) == next->start &&
prev->flags == next->flags && prev->flags == next->flags &&
prev->bdev == next->bdev && prev->bdev == next->bdev &&
...@@ -209,9 +217,7 @@ static void try_merge_map(struct extent_map_tree *tree, struct extent_map *em) ...@@ -209,9 +217,7 @@ static void try_merge_map(struct extent_map_tree *tree, struct extent_map *em)
em->mod_len = (em->mod_len + em->mod_start) - merge->mod_start; em->mod_len = (em->mod_len + em->mod_start) - merge->mod_start;
em->mod_start = merge->mod_start; em->mod_start = merge->mod_start;
em->generation = max(em->generation, merge->generation); em->generation = max(em->generation, merge->generation);
list_move(&em->list, &tree->modified_extents);
list_del_init(&merge->list);
rb_erase(&merge->rb_node, &tree->map); rb_erase(&merge->rb_node, &tree->map);
free_extent_map(merge); free_extent_map(merge);
} }
...@@ -227,7 +233,6 @@ static void try_merge_map(struct extent_map_tree *tree, struct extent_map *em) ...@@ -227,7 +233,6 @@ static void try_merge_map(struct extent_map_tree *tree, struct extent_map *em)
merge->in_tree = 0; merge->in_tree = 0;
em->mod_len = (merge->mod_start + merge->mod_len) - em->mod_start; em->mod_len = (merge->mod_start + merge->mod_len) - em->mod_start;
em->generation = max(em->generation, merge->generation); em->generation = max(em->generation, merge->generation);
list_del_init(&merge->list);
free_extent_map(merge); free_extent_map(merge);
} }
} }
...@@ -302,7 +307,7 @@ void clear_em_logging(struct extent_map_tree *tree, struct extent_map *em) ...@@ -302,7 +307,7 @@ void clear_em_logging(struct extent_map_tree *tree, struct extent_map *em)
* reference dropped if the merge attempt was successful. * reference dropped if the merge attempt was successful.
*/ */
int add_extent_mapping(struct extent_map_tree *tree, int add_extent_mapping(struct extent_map_tree *tree,
struct extent_map *em) struct extent_map *em, int modified)
{ {
int ret = 0; int ret = 0;
struct rb_node *rb; struct rb_node *rb;
...@@ -324,6 +329,9 @@ int add_extent_mapping(struct extent_map_tree *tree, ...@@ -324,6 +329,9 @@ int add_extent_mapping(struct extent_map_tree *tree,
em->mod_start = em->start; em->mod_start = em->start;
em->mod_len = em->len; em->mod_len = em->len;
if (modified)
list_move(&em->list, &tree->modified_extents);
else
try_merge_map(tree, em); try_merge_map(tree, em);
out: out:
return ret; return ret;
...@@ -337,7 +345,8 @@ static u64 range_end(u64 start, u64 len) ...@@ -337,7 +345,8 @@ static u64 range_end(u64 start, u64 len)
return start + len; return start + len;
} }
struct extent_map *__lookup_extent_mapping(struct extent_map_tree *tree, static struct extent_map *
__lookup_extent_mapping(struct extent_map_tree *tree,
u64 start, u64 len, int strict) u64 start, u64 len, int strict)
{ {
struct extent_map *em; struct extent_map *em;
......
...@@ -26,6 +26,7 @@ struct extent_map { ...@@ -26,6 +26,7 @@ struct extent_map {
u64 mod_len; u64 mod_len;
u64 orig_start; u64 orig_start;
u64 orig_block_len; u64 orig_block_len;
u64 ram_bytes;
u64 block_start; u64 block_start;
u64 block_len; u64 block_len;
u64 generation; u64 generation;
...@@ -61,7 +62,7 @@ void extent_map_tree_init(struct extent_map_tree *tree); ...@@ -61,7 +62,7 @@ void extent_map_tree_init(struct extent_map_tree *tree);
struct extent_map *lookup_extent_mapping(struct extent_map_tree *tree, struct extent_map *lookup_extent_mapping(struct extent_map_tree *tree,
u64 start, u64 len); u64 start, u64 len);
int add_extent_mapping(struct extent_map_tree *tree, int add_extent_mapping(struct extent_map_tree *tree,
struct extent_map *em); struct extent_map *em, int modified);
int remove_extent_mapping(struct extent_map_tree *tree, struct extent_map *em); int remove_extent_mapping(struct extent_map_tree *tree, struct extent_map *em);
struct extent_map *alloc_extent_map(void); struct extent_map *alloc_extent_map(void);
......
...@@ -83,7 +83,8 @@ int btrfs_insert_file_extent(struct btrfs_trans_handle *trans, ...@@ -83,7 +83,8 @@ int btrfs_insert_file_extent(struct btrfs_trans_handle *trans,
return ret; return ret;
} }
struct btrfs_csum_item *btrfs_lookup_csum(struct btrfs_trans_handle *trans, static struct btrfs_csum_item *
btrfs_lookup_csum(struct btrfs_trans_handle *trans,
struct btrfs_root *root, struct btrfs_root *root,
struct btrfs_path *path, struct btrfs_path *path,
u64 bytenr, int cow) u64 bytenr, int cow)
...@@ -152,32 +153,12 @@ int btrfs_lookup_file_extent(struct btrfs_trans_handle *trans, ...@@ -152,32 +153,12 @@ int btrfs_lookup_file_extent(struct btrfs_trans_handle *trans,
return ret; return ret;
} }
u64 btrfs_file_extent_length(struct btrfs_path *path)
{
int extent_type;
struct btrfs_file_extent_item *fi;
u64 len;
fi = btrfs_item_ptr(path->nodes[0], path->slots[0],
struct btrfs_file_extent_item);
extent_type = btrfs_file_extent_type(path->nodes[0], fi);
if (extent_type == BTRFS_FILE_EXTENT_REG ||
extent_type == BTRFS_FILE_EXTENT_PREALLOC)
len = btrfs_file_extent_num_bytes(path->nodes[0], fi);
else if (extent_type == BTRFS_FILE_EXTENT_INLINE)
len = btrfs_file_extent_inline_len(path->nodes[0], fi);
else
BUG();
return len;
}
static int __btrfs_lookup_bio_sums(struct btrfs_root *root, static int __btrfs_lookup_bio_sums(struct btrfs_root *root,
struct inode *inode, struct bio *bio, struct inode *inode, struct bio *bio,
u64 logical_offset, u32 *dst, int dio) u64 logical_offset, u32 *dst, int dio)
{ {
u32 sum; u32 sum[16];
int len;
struct bio_vec *bvec = bio->bi_io_vec; struct bio_vec *bvec = bio->bi_io_vec;
int bio_index = 0; int bio_index = 0;
u64 offset = 0; u64 offset = 0;
...@@ -186,7 +167,7 @@ static int __btrfs_lookup_bio_sums(struct btrfs_root *root, ...@@ -186,7 +167,7 @@ static int __btrfs_lookup_bio_sums(struct btrfs_root *root,
u64 disk_bytenr; u64 disk_bytenr;
u32 diff; u32 diff;
u16 csum_size = btrfs_super_csum_size(root->fs_info->super_copy); u16 csum_size = btrfs_super_csum_size(root->fs_info->super_copy);
int ret; int count;
struct btrfs_path *path; struct btrfs_path *path;
struct btrfs_csum_item *item = NULL; struct btrfs_csum_item *item = NULL;
struct extent_io_tree *io_tree = &BTRFS_I(inode)->io_tree; struct extent_io_tree *io_tree = &BTRFS_I(inode)->io_tree;
...@@ -214,10 +195,12 @@ static int __btrfs_lookup_bio_sums(struct btrfs_root *root, ...@@ -214,10 +195,12 @@ static int __btrfs_lookup_bio_sums(struct btrfs_root *root,
if (dio) if (dio)
offset = logical_offset; offset = logical_offset;
while (bio_index < bio->bi_vcnt) { while (bio_index < bio->bi_vcnt) {
len = min_t(int, ARRAY_SIZE(sum), bio->bi_vcnt - bio_index);
if (!dio) if (!dio)
offset = page_offset(bvec->bv_page) + bvec->bv_offset; offset = page_offset(bvec->bv_page) + bvec->bv_offset;
ret = btrfs_find_ordered_sum(inode, offset, disk_bytenr, &sum); count = btrfs_find_ordered_sum(inode, offset, disk_bytenr, sum,
if (ret == 0) len);
if (count)
goto found; goto found;
if (!item || disk_bytenr < item_start_offset || if (!item || disk_bytenr < item_start_offset ||
...@@ -230,10 +213,8 @@ static int __btrfs_lookup_bio_sums(struct btrfs_root *root, ...@@ -230,10 +213,8 @@ static int __btrfs_lookup_bio_sums(struct btrfs_root *root,
item = btrfs_lookup_csum(NULL, root->fs_info->csum_root, item = btrfs_lookup_csum(NULL, root->fs_info->csum_root,
path, disk_bytenr, 0); path, disk_bytenr, 0);
if (IS_ERR(item)) { if (IS_ERR(item)) {
ret = PTR_ERR(item); count = 1;
if (ret == -ENOENT || ret == -EFBIG) sum[0] = 0;
ret = 0;
sum = 0;
if (BTRFS_I(inode)->root->root_key.objectid == if (BTRFS_I(inode)->root->root_key.objectid ==
BTRFS_DATA_RELOC_TREE_OBJECTID) { BTRFS_DATA_RELOC_TREE_OBJECTID) {
set_extent_bits(io_tree, offset, set_extent_bits(io_tree, offset,
...@@ -269,20 +250,30 @@ static int __btrfs_lookup_bio_sums(struct btrfs_root *root, ...@@ -269,20 +250,30 @@ static int __btrfs_lookup_bio_sums(struct btrfs_root *root,
diff = disk_bytenr - item_start_offset; diff = disk_bytenr - item_start_offset;
diff = diff / root->sectorsize; diff = diff / root->sectorsize;
diff = diff * csum_size; diff = diff * csum_size;
count = min_t(int, len, (item_last_offset - disk_bytenr) >>
read_extent_buffer(path->nodes[0], &sum, inode->i_sb->s_blocksize_bits);
read_extent_buffer(path->nodes[0], sum,
((unsigned long)item) + diff, ((unsigned long)item) + diff,
csum_size); csum_size * count);
found: found:
if (dst) if (dst) {
*dst++ = sum; memcpy(dst, sum, count * csum_size);
dst += count;
} else {
if (dio)
extent_cache_csums_dio(io_tree, offset, sum,
count);
else else
set_state_private(io_tree, offset, sum); extent_cache_csums(io_tree, bio, bio_index, sum,
count);
}
while (count--) {
disk_bytenr += bvec->bv_len; disk_bytenr += bvec->bv_len;
offset += bvec->bv_len; offset += bvec->bv_len;
bio_index++; bio_index++;
bvec++; bvec++;
} }
}
btrfs_free_path(path); btrfs_free_path(path);
return 0; return 0;
} }
...@@ -358,11 +349,8 @@ int btrfs_lookup_csums_range(struct btrfs_root *root, u64 start, u64 end, ...@@ -358,11 +349,8 @@ int btrfs_lookup_csums_range(struct btrfs_root *root, u64 start, u64 end,
btrfs_item_key_to_cpu(leaf, &key, path->slots[0]); btrfs_item_key_to_cpu(leaf, &key, path->slots[0]);
if (key.objectid != BTRFS_EXTENT_CSUM_OBJECTID || if (key.objectid != BTRFS_EXTENT_CSUM_OBJECTID ||
key.type != BTRFS_EXTENT_CSUM_KEY) key.type != BTRFS_EXTENT_CSUM_KEY ||
break; key.offset > end)
btrfs_item_key_to_cpu(leaf, &key, path->slots[0]);
if (key.offset > end)
break; break;
if (key.offset > start) if (key.offset > start)
...@@ -484,8 +472,7 @@ int btrfs_csum_one_bio(struct btrfs_root *root, struct inode *inode, ...@@ -484,8 +472,7 @@ int btrfs_csum_one_bio(struct btrfs_root *root, struct inode *inode,
data = kmap_atomic(bvec->bv_page); data = kmap_atomic(bvec->bv_page);
sector_sum->sum = ~(u32)0; sector_sum->sum = ~(u32)0;
sector_sum->sum = btrfs_csum_data(root, sector_sum->sum = btrfs_csum_data(data + bvec->bv_offset,
data + bvec->bv_offset,
sector_sum->sum, sector_sum->sum,
bvec->bv_len); bvec->bv_len);
kunmap_atomic(data); kunmap_atomic(data);
...@@ -518,8 +505,7 @@ int btrfs_csum_one_bio(struct btrfs_root *root, struct inode *inode, ...@@ -518,8 +505,7 @@ int btrfs_csum_one_bio(struct btrfs_root *root, struct inode *inode,
* This calls btrfs_truncate_item with the correct args based on the * This calls btrfs_truncate_item with the correct args based on the
* overlap, and fixes up the key as required. * overlap, and fixes up the key as required.
*/ */
static noinline void truncate_one_csum(struct btrfs_trans_handle *trans, static noinline void truncate_one_csum(struct btrfs_root *root,
struct btrfs_root *root,
struct btrfs_path *path, struct btrfs_path *path,
struct btrfs_key *key, struct btrfs_key *key,
u64 bytenr, u64 len) u64 bytenr, u64 len)
...@@ -544,7 +530,7 @@ static noinline void truncate_one_csum(struct btrfs_trans_handle *trans, ...@@ -544,7 +530,7 @@ static noinline void truncate_one_csum(struct btrfs_trans_handle *trans,
*/ */
u32 new_size = (bytenr - key->offset) >> blocksize_bits; u32 new_size = (bytenr - key->offset) >> blocksize_bits;
new_size *= csum_size; new_size *= csum_size;
btrfs_truncate_item(trans, root, path, new_size, 1); btrfs_truncate_item(root, path, new_size, 1);
} else if (key->offset >= bytenr && csum_end > end_byte && } else if (key->offset >= bytenr && csum_end > end_byte &&
end_byte > key->offset) { end_byte > key->offset) {
/* /*
...@@ -556,10 +542,10 @@ static noinline void truncate_one_csum(struct btrfs_trans_handle *trans, ...@@ -556,10 +542,10 @@ static noinline void truncate_one_csum(struct btrfs_trans_handle *trans,
u32 new_size = (csum_end - end_byte) >> blocksize_bits; u32 new_size = (csum_end - end_byte) >> blocksize_bits;
new_size *= csum_size; new_size *= csum_size;
btrfs_truncate_item(trans, root, path, new_size, 0); btrfs_truncate_item(root, path, new_size, 0);
key->offset = end_byte; key->offset = end_byte;
btrfs_set_item_key_safe(trans, root, path, key); btrfs_set_item_key_safe(root, path, key);
} else { } else {
BUG(); BUG();
} }
...@@ -674,7 +660,7 @@ int btrfs_del_csums(struct btrfs_trans_handle *trans, ...@@ -674,7 +660,7 @@ int btrfs_del_csums(struct btrfs_trans_handle *trans,
key.offset = end_byte - 1; key.offset = end_byte - 1;
} else { } else {
truncate_one_csum(trans, root, path, &key, bytenr, len); truncate_one_csum(root, path, &key, bytenr, len);
if (key.offset < bytenr) if (key.offset < bytenr)
break; break;
} }
...@@ -835,7 +821,7 @@ int btrfs_csum_file_blocks(struct btrfs_trans_handle *trans, ...@@ -835,7 +821,7 @@ int btrfs_csum_file_blocks(struct btrfs_trans_handle *trans,
diff /= csum_size; diff /= csum_size;
diff *= csum_size; diff *= csum_size;
btrfs_extend_item(trans, root, path, diff); btrfs_extend_item(root, path, diff);
goto csum; goto csum;
} }
......
...@@ -193,7 +193,7 @@ int btrfs_add_inode_defrag(struct btrfs_trans_handle *trans, ...@@ -193,7 +193,7 @@ int btrfs_add_inode_defrag(struct btrfs_trans_handle *trans,
* the same inode in the tree, we will merge them together (by * the same inode in the tree, we will merge them together (by
* __btrfs_add_inode_defrag()) and free the one that we want to requeue. * __btrfs_add_inode_defrag()) and free the one that we want to requeue.
*/ */
void btrfs_requeue_inode_defrag(struct inode *inode, static void btrfs_requeue_inode_defrag(struct inode *inode,
struct inode_defrag *defrag) struct inode_defrag *defrag)
{ {
struct btrfs_root *root = BTRFS_I(inode)->root; struct btrfs_root *root = BTRFS_I(inode)->root;
...@@ -474,7 +474,7 @@ static noinline int btrfs_copy_from_user(loff_t pos, int num_pages, ...@@ -474,7 +474,7 @@ static noinline int btrfs_copy_from_user(loff_t pos, int num_pages,
/* /*
* unlocks pages after btrfs_file_write is done with them * unlocks pages after btrfs_file_write is done with them
*/ */
void btrfs_drop_pages(struct page **pages, size_t num_pages) static void btrfs_drop_pages(struct page **pages, size_t num_pages)
{ {
size_t i; size_t i;
for (i = 0; i < num_pages; i++) { for (i = 0; i < num_pages; i++) {
...@@ -553,6 +553,7 @@ void btrfs_drop_extent_cache(struct inode *inode, u64 start, u64 end, ...@@ -553,6 +553,7 @@ void btrfs_drop_extent_cache(struct inode *inode, u64 start, u64 end,
int testend = 1; int testend = 1;
unsigned long flags; unsigned long flags;
int compressed = 0; int compressed = 0;
bool modified;
WARN_ON(end < start); WARN_ON(end < start);
if (end == (u64)-1) { if (end == (u64)-1) {
...@@ -562,6 +563,7 @@ void btrfs_drop_extent_cache(struct inode *inode, u64 start, u64 end, ...@@ -562,6 +563,7 @@ void btrfs_drop_extent_cache(struct inode *inode, u64 start, u64 end,
while (1) { while (1) {
int no_splits = 0; int no_splits = 0;
modified = false;
if (!split) if (!split)
split = alloc_extent_map(); split = alloc_extent_map();
if (!split2) if (!split2)
...@@ -593,6 +595,7 @@ void btrfs_drop_extent_cache(struct inode *inode, u64 start, u64 end, ...@@ -593,6 +595,7 @@ void btrfs_drop_extent_cache(struct inode *inode, u64 start, u64 end,
compressed = test_bit(EXTENT_FLAG_COMPRESSED, &em->flags); compressed = test_bit(EXTENT_FLAG_COMPRESSED, &em->flags);
clear_bit(EXTENT_FLAG_PINNED, &em->flags); clear_bit(EXTENT_FLAG_PINNED, &em->flags);
clear_bit(EXTENT_FLAG_LOGGING, &flags); clear_bit(EXTENT_FLAG_LOGGING, &flags);
modified = !list_empty(&em->list);
remove_extent_mapping(em_tree, em); remove_extent_mapping(em_tree, em);
if (no_splits) if (no_splits)
goto next; goto next;
...@@ -608,15 +611,15 @@ void btrfs_drop_extent_cache(struct inode *inode, u64 start, u64 end, ...@@ -608,15 +611,15 @@ void btrfs_drop_extent_cache(struct inode *inode, u64 start, u64 end,
split->block_len = em->block_len; split->block_len = em->block_len;
else else
split->block_len = split->len; split->block_len = split->len;
split->ram_bytes = em->ram_bytes;
split->orig_block_len = max(split->block_len, split->orig_block_len = max(split->block_len,
em->orig_block_len); em->orig_block_len);
split->generation = gen; split->generation = gen;
split->bdev = em->bdev; split->bdev = em->bdev;
split->flags = flags; split->flags = flags;
split->compress_type = em->compress_type; split->compress_type = em->compress_type;
ret = add_extent_mapping(em_tree, split); ret = add_extent_mapping(em_tree, split, modified);
BUG_ON(ret); /* Logic error */ BUG_ON(ret); /* Logic error */
list_move(&split->list, &em_tree->modified_extents);
free_extent_map(split); free_extent_map(split);
split = split2; split = split2;
split2 = NULL; split2 = NULL;
...@@ -633,6 +636,7 @@ void btrfs_drop_extent_cache(struct inode *inode, u64 start, u64 end, ...@@ -633,6 +636,7 @@ void btrfs_drop_extent_cache(struct inode *inode, u64 start, u64 end,
split->generation = gen; split->generation = gen;
split->orig_block_len = max(em->block_len, split->orig_block_len = max(em->block_len,
em->orig_block_len); em->orig_block_len);
split->ram_bytes = em->ram_bytes;
if (compressed) { if (compressed) {
split->block_len = em->block_len; split->block_len = em->block_len;
...@@ -644,9 +648,8 @@ void btrfs_drop_extent_cache(struct inode *inode, u64 start, u64 end, ...@@ -644,9 +648,8 @@ void btrfs_drop_extent_cache(struct inode *inode, u64 start, u64 end,
split->orig_start = em->orig_start; split->orig_start = em->orig_start;
} }
ret = add_extent_mapping(em_tree, split); ret = add_extent_mapping(em_tree, split, modified);
BUG_ON(ret); /* Logic error */ BUG_ON(ret); /* Logic error */
list_move(&split->list, &em_tree->modified_extents);
free_extent_map(split); free_extent_map(split);
split = NULL; split = NULL;
} }
...@@ -822,7 +825,7 @@ int __btrfs_drop_extents(struct btrfs_trans_handle *trans, ...@@ -822,7 +825,7 @@ int __btrfs_drop_extents(struct btrfs_trans_handle *trans,
memcpy(&new_key, &key, sizeof(new_key)); memcpy(&new_key, &key, sizeof(new_key));
new_key.offset = end; new_key.offset = end;
btrfs_set_item_key_safe(trans, root, path, &new_key); btrfs_set_item_key_safe(root, path, &new_key);
extent_offset += end - key.offset; extent_offset += end - key.offset;
btrfs_set_file_extent_offset(leaf, fi, extent_offset); btrfs_set_file_extent_offset(leaf, fi, extent_offset);
...@@ -1038,7 +1041,7 @@ int btrfs_mark_extent_written(struct btrfs_trans_handle *trans, ...@@ -1038,7 +1041,7 @@ int btrfs_mark_extent_written(struct btrfs_trans_handle *trans,
ino, bytenr, orig_offset, ino, bytenr, orig_offset,
&other_start, &other_end)) { &other_start, &other_end)) {
new_key.offset = end; new_key.offset = end;
btrfs_set_item_key_safe(trans, root, path, &new_key); btrfs_set_item_key_safe(root, path, &new_key);
fi = btrfs_item_ptr(leaf, path->slots[0], fi = btrfs_item_ptr(leaf, path->slots[0],
struct btrfs_file_extent_item); struct btrfs_file_extent_item);
btrfs_set_file_extent_generation(leaf, fi, btrfs_set_file_extent_generation(leaf, fi,
...@@ -1072,7 +1075,7 @@ int btrfs_mark_extent_written(struct btrfs_trans_handle *trans, ...@@ -1072,7 +1075,7 @@ int btrfs_mark_extent_written(struct btrfs_trans_handle *trans,
trans->transid); trans->transid);
path->slots[0]++; path->slots[0]++;
new_key.offset = start; new_key.offset = start;
btrfs_set_item_key_safe(trans, root, path, &new_key); btrfs_set_item_key_safe(root, path, &new_key);
fi = btrfs_item_ptr(leaf, path->slots[0], fi = btrfs_item_ptr(leaf, path->slots[0],
struct btrfs_file_extent_item); struct btrfs_file_extent_item);
...@@ -1883,7 +1886,7 @@ static int fill_holes(struct btrfs_trans_handle *trans, struct inode *inode, ...@@ -1883,7 +1886,7 @@ static int fill_holes(struct btrfs_trans_handle *trans, struct inode *inode,
path->slots[0]++; path->slots[0]++;
key.offset = offset; key.offset = offset;
btrfs_set_item_key_safe(trans, root, path, &key); btrfs_set_item_key_safe(root, path, &key);
fi = btrfs_item_ptr(leaf, path->slots[0], fi = btrfs_item_ptr(leaf, path->slots[0],
struct btrfs_file_extent_item); struct btrfs_file_extent_item);
num_bytes = btrfs_file_extent_num_bytes(leaf, fi) + end - num_bytes = btrfs_file_extent_num_bytes(leaf, fi) + end -
...@@ -1913,6 +1916,7 @@ static int fill_holes(struct btrfs_trans_handle *trans, struct inode *inode, ...@@ -1913,6 +1916,7 @@ static int fill_holes(struct btrfs_trans_handle *trans, struct inode *inode,
} else { } else {
hole_em->start = offset; hole_em->start = offset;
hole_em->len = end - offset; hole_em->len = end - offset;
hole_em->ram_bytes = hole_em->len;
hole_em->orig_start = offset; hole_em->orig_start = offset;
hole_em->block_start = EXTENT_MAP_HOLE; hole_em->block_start = EXTENT_MAP_HOLE;
...@@ -1925,10 +1929,7 @@ static int fill_holes(struct btrfs_trans_handle *trans, struct inode *inode, ...@@ -1925,10 +1929,7 @@ static int fill_holes(struct btrfs_trans_handle *trans, struct inode *inode,
do { do {
btrfs_drop_extent_cache(inode, offset, end - 1, 0); btrfs_drop_extent_cache(inode, offset, end - 1, 0);
write_lock(&em_tree->lock); write_lock(&em_tree->lock);
ret = add_extent_mapping(em_tree, hole_em); ret = add_extent_mapping(em_tree, hole_em, 1);
if (!ret)
list_move(&hole_em->list,
&em_tree->modified_extents);
write_unlock(&em_tree->lock); write_unlock(&em_tree->lock);
} while (ret == -EEXIST); } while (ret == -EEXIST);
free_extent_map(hole_em); free_extent_map(hole_em);
......
This diff is collapsed.
...@@ -110,4 +110,9 @@ int btrfs_return_cluster_to_free_space( ...@@ -110,4 +110,9 @@ int btrfs_return_cluster_to_free_space(
struct btrfs_free_cluster *cluster); struct btrfs_free_cluster *cluster);
int btrfs_trim_block_group(struct btrfs_block_group_cache *block_group, int btrfs_trim_block_group(struct btrfs_block_group_cache *block_group,
u64 *trimmed, u64 start, u64 end, u64 minlen); u64 *trimmed, u64 start, u64 end, u64 minlen);
#ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS
void btrfs_test_free_space_cache(void);
#endif
#endif #endif
...@@ -183,10 +183,11 @@ int btrfs_get_inode_ref_index(struct btrfs_trans_handle *trans, ...@@ -183,10 +183,11 @@ int btrfs_get_inode_ref_index(struct btrfs_trans_handle *trans,
return -ENOENT; return -ENOENT;
} }
int btrfs_del_inode_extref(struct btrfs_trans_handle *trans, static int btrfs_del_inode_extref(struct btrfs_trans_handle *trans,
struct btrfs_root *root, struct btrfs_root *root,
const char *name, int name_len, const char *name, int name_len,
u64 inode_objectid, u64 ref_objectid, u64 *index) u64 inode_objectid, u64 ref_objectid,
u64 *index)
{ {
struct btrfs_path *path; struct btrfs_path *path;
struct btrfs_key key; struct btrfs_key key;
...@@ -246,7 +247,7 @@ int btrfs_del_inode_extref(struct btrfs_trans_handle *trans, ...@@ -246,7 +247,7 @@ int btrfs_del_inode_extref(struct btrfs_trans_handle *trans,
memmove_extent_buffer(leaf, ptr, ptr + del_len, memmove_extent_buffer(leaf, ptr, ptr + del_len,
item_size - (ptr + del_len - item_start)); item_size - (ptr + del_len - item_start));
btrfs_truncate_item(trans, root, path, item_size - del_len, 1); btrfs_truncate_item(root, path, item_size - del_len, 1);
out: out:
btrfs_free_path(path); btrfs_free_path(path);
...@@ -309,7 +310,7 @@ int btrfs_del_inode_ref(struct btrfs_trans_handle *trans, ...@@ -309,7 +310,7 @@ int btrfs_del_inode_ref(struct btrfs_trans_handle *trans,
item_start = btrfs_item_ptr_offset(leaf, path->slots[0]); item_start = btrfs_item_ptr_offset(leaf, path->slots[0]);
memmove_extent_buffer(leaf, ptr, ptr + sub_item_len, memmove_extent_buffer(leaf, ptr, ptr + sub_item_len,
item_size - (ptr + sub_item_len - item_start)); item_size - (ptr + sub_item_len - item_start));
btrfs_truncate_item(trans, root, path, item_size - sub_item_len, 1); btrfs_truncate_item(root, path, item_size - sub_item_len, 1);
out: out:
btrfs_free_path(path); btrfs_free_path(path);
...@@ -361,7 +362,7 @@ static int btrfs_insert_inode_extref(struct btrfs_trans_handle *trans, ...@@ -361,7 +362,7 @@ static int btrfs_insert_inode_extref(struct btrfs_trans_handle *trans,
name, name_len, NULL)) name, name_len, NULL))
goto out; goto out;
btrfs_extend_item(trans, root, path, ins_len); btrfs_extend_item(root, path, ins_len);
ret = 0; ret = 0;
} }
if (ret < 0) if (ret < 0)
...@@ -417,7 +418,7 @@ int btrfs_insert_inode_ref(struct btrfs_trans_handle *trans, ...@@ -417,7 +418,7 @@ int btrfs_insert_inode_ref(struct btrfs_trans_handle *trans,
goto out; goto out;
old_size = btrfs_item_size_nr(path->nodes[0], path->slots[0]); old_size = btrfs_item_size_nr(path->nodes[0], path->slots[0]);
btrfs_extend_item(trans, root, path, ins_len); btrfs_extend_item(root, path, ins_len);
ref = btrfs_item_ptr(path->nodes[0], path->slots[0], ref = btrfs_item_ptr(path->nodes[0], path->slots[0],
struct btrfs_inode_ref); struct btrfs_inode_ref);
ref = (struct btrfs_inode_ref *)((unsigned long)ref + old_size); ref = (struct btrfs_inode_ref *)((unsigned long)ref + old_size);
......
This diff is collapsed.
...@@ -723,7 +723,9 @@ static noinline int btrfs_mksubvol(struct path *parent, ...@@ -723,7 +723,9 @@ static noinline int btrfs_mksubvol(struct path *parent,
struct dentry *dentry; struct dentry *dentry;
int error; int error;
mutex_lock_nested(&dir->i_mutex, I_MUTEX_PARENT); error = mutex_lock_killable_nested(&dir->i_mutex, I_MUTEX_PARENT);
if (error == -EINTR)
return error;
dentry = lookup_one_len(name, parent->dentry, namelen); dentry = lookup_one_len(name, parent->dentry, namelen);
error = PTR_ERR(dentry); error = PTR_ERR(dentry);
...@@ -1152,8 +1154,11 @@ int btrfs_defrag_file(struct inode *inode, struct file *file, ...@@ -1152,8 +1154,11 @@ int btrfs_defrag_file(struct inode *inode, struct file *file,
u64 new_align = ~((u64)128 * 1024 - 1); u64 new_align = ~((u64)128 * 1024 - 1);
struct page **pages = NULL; struct page **pages = NULL;
if (extent_thresh == 0) if (isize == 0)
extent_thresh = 256 * 1024; return 0;
if (range->start >= isize)
return -EINVAL;
if (range->flags & BTRFS_DEFRAG_RANGE_COMPRESS) { if (range->flags & BTRFS_DEFRAG_RANGE_COMPRESS) {
if (range->compress_type > BTRFS_COMPRESS_TYPES) if (range->compress_type > BTRFS_COMPRESS_TYPES)
...@@ -1162,8 +1167,8 @@ int btrfs_defrag_file(struct inode *inode, struct file *file, ...@@ -1162,8 +1167,8 @@ int btrfs_defrag_file(struct inode *inode, struct file *file,
compress_type = range->compress_type; compress_type = range->compress_type;
} }
if (isize == 0) if (extent_thresh == 0)
return 0; extent_thresh = 256 * 1024;
/* /*
* if we were not given a file, allocate a readahead * if we were not given a file, allocate a readahead
...@@ -2086,7 +2091,9 @@ static noinline int btrfs_ioctl_snap_destroy(struct file *file, ...@@ -2086,7 +2091,9 @@ static noinline int btrfs_ioctl_snap_destroy(struct file *file,
if (err) if (err)
goto out; goto out;
mutex_lock_nested(&dir->i_mutex, I_MUTEX_PARENT); err = mutex_lock_killable_nested(&dir->i_mutex, I_MUTEX_PARENT);
if (err == -EINTR)
goto out;
dentry = lookup_one_len(vol_args->name, parent, namelen); dentry = lookup_one_len(vol_args->name, parent, namelen);
if (IS_ERR(dentry)) { if (IS_ERR(dentry)) {
err = PTR_ERR(dentry); err = PTR_ERR(dentry);
...@@ -2425,7 +2432,6 @@ static long btrfs_ioctl_dev_info(struct btrfs_root *root, void __user *arg) ...@@ -2425,7 +2432,6 @@ static long btrfs_ioctl_dev_info(struct btrfs_root *root, void __user *arg)
mutex_lock(&fs_devices->device_list_mutex); mutex_lock(&fs_devices->device_list_mutex);
dev = btrfs_find_device(root->fs_info, di_args->devid, s_uuid, NULL); dev = btrfs_find_device(root->fs_info, di_args->devid, s_uuid, NULL);
mutex_unlock(&fs_devices->device_list_mutex);
if (!dev) { if (!dev) {
ret = -ENODEV; ret = -ENODEV;
...@@ -2449,6 +2455,7 @@ static long btrfs_ioctl_dev_info(struct btrfs_root *root, void __user *arg) ...@@ -2449,6 +2455,7 @@ static long btrfs_ioctl_dev_info(struct btrfs_root *root, void __user *arg)
} }
out: out:
mutex_unlock(&fs_devices->device_list_mutex);
if (ret == 0 && copy_to_user(arg, di_args, sizeof(*di_args))) if (ret == 0 && copy_to_user(arg, di_args, sizeof(*di_args)))
ret = -EFAULT; ret = -EFAULT;
...@@ -3003,7 +3010,7 @@ void btrfs_get_block_group_info(struct list_head *groups_list, ...@@ -3003,7 +3010,7 @@ void btrfs_get_block_group_info(struct list_head *groups_list,
} }
} }
long btrfs_ioctl_space_info(struct btrfs_root *root, void __user *arg) static long btrfs_ioctl_space_info(struct btrfs_root *root, void __user *arg)
{ {
struct btrfs_ioctl_space_args space_args; struct btrfs_ioctl_space_args space_args;
struct btrfs_ioctl_space_info space; struct btrfs_ioctl_space_info space;
...@@ -3693,13 +3700,12 @@ static long btrfs_ioctl_quota_ctl(struct file *file, void __user *arg) ...@@ -3693,13 +3700,12 @@ static long btrfs_ioctl_quota_ctl(struct file *file, void __user *arg)
goto drop_write; goto drop_write;
} }
if (sa->cmd != BTRFS_QUOTA_CTL_RESCAN) { down_write(&root->fs_info->subvol_sem);
trans = btrfs_start_transaction(root, 2); trans = btrfs_start_transaction(root->fs_info->tree_root, 2);
if (IS_ERR(trans)) { if (IS_ERR(trans)) {
ret = PTR_ERR(trans); ret = PTR_ERR(trans);
goto out; goto out;
} }
}
switch (sa->cmd) { switch (sa->cmd) {
case BTRFS_QUOTA_CTL_ENABLE: case BTRFS_QUOTA_CTL_ENABLE:
...@@ -3708,9 +3714,6 @@ static long btrfs_ioctl_quota_ctl(struct file *file, void __user *arg) ...@@ -3708,9 +3714,6 @@ static long btrfs_ioctl_quota_ctl(struct file *file, void __user *arg)
case BTRFS_QUOTA_CTL_DISABLE: case BTRFS_QUOTA_CTL_DISABLE:
ret = btrfs_quota_disable(trans, root->fs_info); ret = btrfs_quota_disable(trans, root->fs_info);
break; break;
case BTRFS_QUOTA_CTL_RESCAN:
ret = btrfs_quota_rescan(root->fs_info);
break;
default: default:
ret = -EINVAL; ret = -EINVAL;
break; break;
...@@ -3719,13 +3722,12 @@ static long btrfs_ioctl_quota_ctl(struct file *file, void __user *arg) ...@@ -3719,13 +3722,12 @@ static long btrfs_ioctl_quota_ctl(struct file *file, void __user *arg)
if (copy_to_user(arg, sa, sizeof(*sa))) if (copy_to_user(arg, sa, sizeof(*sa)))
ret = -EFAULT; ret = -EFAULT;
if (trans) { err = btrfs_commit_transaction(trans, root->fs_info->tree_root);
err = btrfs_commit_transaction(trans, root);
if (err && !ret) if (err && !ret)
ret = err; ret = err;
}
out: out:
kfree(sa); kfree(sa);
up_write(&root->fs_info->subvol_sem);
drop_write: drop_write:
mnt_drop_write_file(file); mnt_drop_write_file(file);
return ret; return ret;
...@@ -3877,6 +3879,64 @@ static long btrfs_ioctl_qgroup_limit(struct file *file, void __user *arg) ...@@ -3877,6 +3879,64 @@ static long btrfs_ioctl_qgroup_limit(struct file *file, void __user *arg)
return ret; return ret;
} }
static long btrfs_ioctl_quota_rescan(struct file *file, void __user *arg)
{
struct btrfs_root *root = BTRFS_I(fdentry(file)->d_inode)->root;
struct btrfs_ioctl_quota_rescan_args *qsa;
int ret;
if (!capable(CAP_SYS_ADMIN))
return -EPERM;
ret = mnt_want_write_file(file);
if (ret)
return ret;
qsa = memdup_user(arg, sizeof(*qsa));
if (IS_ERR(qsa)) {
ret = PTR_ERR(qsa);
goto drop_write;
}
if (qsa->flags) {
ret = -EINVAL;
goto out;
}
ret = btrfs_qgroup_rescan(root->fs_info);
out:
kfree(qsa);
drop_write:
mnt_drop_write_file(file);
return ret;
}
static long btrfs_ioctl_quota_rescan_status(struct file *file, void __user *arg)
{
struct btrfs_root *root = BTRFS_I(fdentry(file)->d_inode)->root;
struct btrfs_ioctl_quota_rescan_args *qsa;
int ret = 0;
if (!capable(CAP_SYS_ADMIN))
return -EPERM;
qsa = kzalloc(sizeof(*qsa), GFP_NOFS);
if (!qsa)
return -ENOMEM;
if (root->fs_info->qgroup_flags & BTRFS_QGROUP_STATUS_FLAG_RESCAN) {
qsa->flags = 1;
qsa->progress = root->fs_info->qgroup_rescan_progress.objectid;
}
if (copy_to_user(arg, qsa, sizeof(*qsa)))
ret = -EFAULT;
kfree(qsa);
return ret;
}
static long btrfs_ioctl_set_received_subvol(struct file *file, static long btrfs_ioctl_set_received_subvol(struct file *file,
void __user *arg) void __user *arg)
{ {
...@@ -4115,6 +4175,10 @@ long btrfs_ioctl(struct file *file, unsigned int ...@@ -4115,6 +4175,10 @@ long btrfs_ioctl(struct file *file, unsigned int
return btrfs_ioctl_qgroup_create(file, argp); return btrfs_ioctl_qgroup_create(file, argp);
case BTRFS_IOC_QGROUP_LIMIT: case BTRFS_IOC_QGROUP_LIMIT:
return btrfs_ioctl_qgroup_limit(file, argp); return btrfs_ioctl_qgroup_limit(file, argp);
case BTRFS_IOC_QUOTA_RESCAN:
return btrfs_ioctl_quota_rescan(file, argp);
case BTRFS_IOC_QUOTA_RESCAN_STATUS:
return btrfs_ioctl_quota_rescan_status(file, argp);
case BTRFS_IOC_DEV_REPLACE: case BTRFS_IOC_DEV_REPLACE:
return btrfs_ioctl_dev_replace(root, argp); return btrfs_ioctl_dev_replace(root, argp);
case BTRFS_IOC_GET_FSLABEL: case BTRFS_IOC_GET_FSLABEL:
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
#include "extent_io.h" #include "extent_io.h"
#include "locking.h" #include "locking.h"
void btrfs_assert_tree_read_locked(struct extent_buffer *eb); static void btrfs_assert_tree_read_locked(struct extent_buffer *eb);
/* /*
* if we currently have a spinning reader or writer lock * if we currently have a spinning reader or writer lock
...@@ -264,7 +264,7 @@ void btrfs_assert_tree_locked(struct extent_buffer *eb) ...@@ -264,7 +264,7 @@ void btrfs_assert_tree_locked(struct extent_buffer *eb)
BUG_ON(!atomic_read(&eb->write_locks)); BUG_ON(!atomic_read(&eb->write_locks));
} }
void btrfs_assert_tree_read_locked(struct extent_buffer *eb) static void btrfs_assert_tree_read_locked(struct extent_buffer *eb)
{ {
BUG_ON(!atomic_read(&eb->read_locks)); BUG_ON(!atomic_read(&eb->read_locks));
} }
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -19,5 +19,5 @@ ...@@ -19,5 +19,5 @@
#ifndef __PRINT_TREE_ #ifndef __PRINT_TREE_
#define __PRINT_TREE_ #define __PRINT_TREE_
void btrfs_print_leaf(struct btrfs_root *root, struct extent_buffer *l); void btrfs_print_leaf(struct btrfs_root *root, struct extent_buffer *l);
void btrfs_print_tree(struct btrfs_root *root, struct extent_buffer *t); void btrfs_print_tree(struct btrfs_root *root, struct extent_buffer *c);
#endif #endif
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment