Skip to content

Commit e9f467d

Browse files
committed
Merge branch 'for-chris-4.11-part2' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux into for-linus-4.11
2 parents ef6ebf3 + 20a7db8 commit e9f467d

31 files changed

+673
-626
lines changed

fs/btrfs/btrfs_inode.h

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -237,20 +237,20 @@ static inline u64 btrfs_ino(struct btrfs_inode *inode)
237237
return ino;
238238
}
239239

240-
static inline void btrfs_i_size_write(struct inode *inode, u64 size)
240+
static inline void btrfs_i_size_write(struct btrfs_inode *inode, u64 size)
241241
{
242-
i_size_write(inode, size);
243-
BTRFS_I(inode)->disk_i_size = size;
242+
i_size_write(&inode->vfs_inode, size);
243+
inode->disk_i_size = size;
244244
}
245245

246-
static inline bool btrfs_is_free_space_inode(struct inode *inode)
246+
static inline bool btrfs_is_free_space_inode(struct btrfs_inode *inode)
247247
{
248-
struct btrfs_root *root = BTRFS_I(inode)->root;
248+
struct btrfs_root *root = inode->root;
249249

250250
if (root == root->fs_info->tree_root &&
251-
btrfs_ino(BTRFS_I(inode)) != BTRFS_BTREE_INODE_OBJECTID)
251+
btrfs_ino(inode) != BTRFS_BTREE_INODE_OBJECTID)
252252
return true;
253-
if (BTRFS_I(inode)->location.objectid == BTRFS_FREE_INO_OBJECTID)
253+
if (inode->location.objectid == BTRFS_FREE_INO_OBJECTID)
254254
return true;
255255
return false;
256256
}
@@ -311,34 +311,33 @@ struct btrfs_dio_private {
311311
* to grab i_mutex. It is used to avoid the endless truncate due to
312312
* nonlocked dio read.
313313
*/
314-
static inline void btrfs_inode_block_unlocked_dio(struct inode *inode)
314+
static inline void btrfs_inode_block_unlocked_dio(struct btrfs_inode *inode)
315315
{
316-
set_bit(BTRFS_INODE_READDIO_NEED_LOCK, &BTRFS_I(inode)->runtime_flags);
316+
set_bit(BTRFS_INODE_READDIO_NEED_LOCK, &inode->runtime_flags);
317317
smp_mb();
318318
}
319319

320-
static inline void btrfs_inode_resume_unlocked_dio(struct inode *inode)
320+
static inline void btrfs_inode_resume_unlocked_dio(struct btrfs_inode *inode)
321321
{
322322
smp_mb__before_atomic();
323-
clear_bit(BTRFS_INODE_READDIO_NEED_LOCK,
324-
&BTRFS_I(inode)->runtime_flags);
323+
clear_bit(BTRFS_INODE_READDIO_NEED_LOCK, &inode->runtime_flags);
325324
}
326325

327-
static inline void btrfs_print_data_csum_error(struct inode *inode,
326+
static inline void btrfs_print_data_csum_error(struct btrfs_inode *inode,
328327
u64 logical_start, u32 csum, u32 csum_expected, int mirror_num)
329328
{
330-
struct btrfs_root *root = BTRFS_I(inode)->root;
329+
struct btrfs_root *root = inode->root;
331330

332331
/* Output minus objectid, which is more meaningful */
333332
if (root->objectid >= BTRFS_LAST_FREE_OBJECTID)
334333
btrfs_warn_rl(root->fs_info,
335334
"csum failed root %lld ino %lld off %llu csum 0x%08x expected csum 0x%08x mirror %d",
336-
root->objectid, btrfs_ino(BTRFS_I(inode)),
335+
root->objectid, btrfs_ino(inode),
337336
logical_start, csum, csum_expected, mirror_num);
338337
else
339338
btrfs_warn_rl(root->fs_info,
340339
"csum failed root %llu ino %llu off %llu csum 0x%08x expected csum 0x%08x mirror %d",
341-
root->objectid, btrfs_ino(BTRFS_I(inode)),
340+
root->objectid, btrfs_ino(inode),
342341
logical_start, csum, csum_expected, mirror_num);
343342
}
344343

fs/btrfs/compression.c

Lines changed: 19 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ static struct bio *compressed_bio_alloc(struct block_device *bdev,
100100
return btrfs_bio_alloc(bdev, first_byte >> 9, BIO_MAX_PAGES, gfp_flags);
101101
}
102102

103-
static int check_compressed_csum(struct inode *inode,
103+
static int check_compressed_csum(struct btrfs_inode *inode,
104104
struct compressed_bio *cb,
105105
u64 disk_start)
106106
{
@@ -111,7 +111,7 @@ static int check_compressed_csum(struct inode *inode,
111111
u32 csum;
112112
u32 *cb_sum = &cb->sums;
113113

114-
if (BTRFS_I(inode)->flags & BTRFS_INODE_NODATASUM)
114+
if (inode->flags & BTRFS_INODE_NODATASUM)
115115
return 0;
116116

117117
for (i = 0; i < cb->nr_pages; i++) {
@@ -125,7 +125,7 @@ static int check_compressed_csum(struct inode *inode,
125125

126126
if (csum != *cb_sum) {
127127
btrfs_print_data_csum_error(inode, disk_start, csum,
128-
*cb_sum, cb->mirror_num);
128+
*cb_sum, cb->mirror_num);
129129
ret = -EIO;
130130
goto fail;
131131
}
@@ -165,7 +165,7 @@ static void end_compressed_bio_read(struct bio *bio)
165165
goto out;
166166

167167
inode = cb->inode;
168-
ret = check_compressed_csum(inode, cb,
168+
ret = check_compressed_csum(BTRFS_I(inode), cb,
169169
(u64)bio->bi_iter.bi_sector << 9);
170170
if (ret)
171171
goto csum_failed;
@@ -911,43 +911,38 @@ static void free_workspaces(void)
911911
}
912912

913913
/*
914-
* given an address space and start/len, compress the bytes.
914+
* Given an address space and start and length, compress the bytes into @pages
915+
* that are allocated on demand.
915916
*
916-
* pages are allocated to hold the compressed result and stored
917-
* in 'pages'
917+
* @out_pages is an in/out parameter, holds maximum number of pages to allocate
918+
* and returns number of actually allocated pages
918919
*
919-
* out_pages is used to return the number of pages allocated. There
920-
* may be pages allocated even if we return an error
921-
*
922-
* total_in is used to return the number of bytes actually read. It
923-
* may be smaller then len if we had to exit early because we
920+
* @total_in is used to return the number of bytes actually read. It
921+
* may be smaller than the input length if we had to exit early because we
924922
* ran out of room in the pages array or because we cross the
925923
* max_out threshold.
926924
*
927-
* total_out is used to return the total number of compressed bytes
925+
* @total_out is an in/out parameter, must be set to the input length and will
926+
* be also used to return the total number of compressed bytes
928927
*
929-
* max_out tells us the max number of bytes that we're allowed to
928+
* @max_out tells us the max number of bytes that we're allowed to
930929
* stuff into pages
931930
*/
932931
int btrfs_compress_pages(int type, struct address_space *mapping,
933-
u64 start, unsigned long len,
934-
struct page **pages,
935-
unsigned long nr_dest_pages,
932+
u64 start, struct page **pages,
936933
unsigned long *out_pages,
937934
unsigned long *total_in,
938-
unsigned long *total_out,
939-
unsigned long max_out)
935+
unsigned long *total_out)
940936
{
941937
struct list_head *workspace;
942938
int ret;
943939

944940
workspace = find_workspace(type);
945941

946942
ret = btrfs_compress_op[type-1]->compress_pages(workspace, mapping,
947-
start, len, pages,
948-
nr_dest_pages, out_pages,
949-
total_in, total_out,
950-
max_out);
943+
start, pages,
944+
out_pages,
945+
total_in, total_out);
951946
free_workspace(type, workspace);
952947
return ret;
953948
}
@@ -1015,7 +1010,7 @@ void btrfs_exit_compress(void)
10151010
*
10161011
* total_out is the last byte of the buffer
10171012
*/
1018-
int btrfs_decompress_buf2page(char *buf, unsigned long buf_start,
1013+
int btrfs_decompress_buf2page(const char *buf, unsigned long buf_start,
10191014
unsigned long total_out, u64 disk_start,
10201015
struct bio *bio)
10211016
{

fs/btrfs/compression.h

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,32 @@
1919
#ifndef __BTRFS_COMPRESSION_
2020
#define __BTRFS_COMPRESSION_
2121

22+
/*
23+
* We want to make sure that amount of RAM required to uncompress an extent is
24+
* reasonable, so we limit the total size in ram of a compressed extent to
25+
* 128k. This is a crucial number because it also controls how easily we can
26+
* spread reads across cpus for decompression.
27+
*
28+
* We also want to make sure the amount of IO required to do a random read is
29+
* reasonably small, so we limit the size of a compressed extent to 128k.
30+
*/
31+
32+
/* Maximum length of compressed data stored on disk */
33+
#define BTRFS_MAX_COMPRESSED (SZ_128K)
34+
/* Maximum size of data before compression */
35+
#define BTRFS_MAX_UNCOMPRESSED (SZ_128K)
36+
2237
void btrfs_init_compress(void);
2338
void btrfs_exit_compress(void);
2439

2540
int btrfs_compress_pages(int type, struct address_space *mapping,
26-
u64 start, unsigned long len,
27-
struct page **pages,
28-
unsigned long nr_dest_pages,
41+
u64 start, struct page **pages,
2942
unsigned long *out_pages,
3043
unsigned long *total_in,
31-
unsigned long *total_out,
32-
unsigned long max_out);
44+
unsigned long *total_out);
3345
int btrfs_decompress(int type, unsigned char *data_in, struct page *dest_page,
3446
unsigned long start_byte, size_t srclen, size_t destlen);
35-
int btrfs_decompress_buf2page(char *buf, unsigned long buf_start,
47+
int btrfs_decompress_buf2page(const char *buf, unsigned long buf_start,
3648
unsigned long total_out, u64 disk_start,
3749
struct bio *bio);
3850

@@ -59,13 +71,11 @@ struct btrfs_compress_op {
5971

6072
int (*compress_pages)(struct list_head *workspace,
6173
struct address_space *mapping,
62-
u64 start, unsigned long len,
74+
u64 start,
6375
struct page **pages,
64-
unsigned long nr_dest_pages,
6576
unsigned long *out_pages,
6677
unsigned long *total_in,
67-
unsigned long *total_out,
68-
unsigned long max_out);
78+
unsigned long *total_out);
6979

7080
int (*decompress_bio)(struct list_head *workspace,
7181
struct page **pages_in,

fs/btrfs/ctree.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -453,8 +453,6 @@ __tree_mod_log_insert(struct btrfs_fs_info *fs_info, struct tree_mod_elem *tm)
453453
struct rb_node *parent = NULL;
454454
struct tree_mod_elem *cur;
455455

456-
BUG_ON(!tm);
457-
458456
tm->seq = btrfs_inc_tree_mod_seq(fs_info);
459457

460458
tm_root = &fs_info->tree_mod_log;

fs/btrfs/ctree.h

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2687,24 +2687,24 @@ enum btrfs_flush_state {
26872687
};
26882688

26892689
int btrfs_check_data_free_space(struct inode *inode, u64 start, u64 len);
2690-
int btrfs_alloc_data_chunk_ondemand(struct inode *inode, u64 bytes);
2690+
int btrfs_alloc_data_chunk_ondemand(struct btrfs_inode *inode, u64 bytes);
26912691
void btrfs_free_reserved_data_space(struct inode *inode, u64 start, u64 len);
26922692
void btrfs_free_reserved_data_space_noquota(struct inode *inode, u64 start,
26932693
u64 len);
26942694
void btrfs_trans_release_metadata(struct btrfs_trans_handle *trans,
26952695
struct btrfs_fs_info *fs_info);
26962696
void btrfs_trans_release_chunk_metadata(struct btrfs_trans_handle *trans);
26972697
int btrfs_orphan_reserve_metadata(struct btrfs_trans_handle *trans,
2698-
struct inode *inode);
2699-
void btrfs_orphan_release_metadata(struct inode *inode);
2698+
struct btrfs_inode *inode);
2699+
void btrfs_orphan_release_metadata(struct btrfs_inode *inode);
27002700
int btrfs_subvolume_reserve_metadata(struct btrfs_root *root,
27012701
struct btrfs_block_rsv *rsv,
27022702
int nitems,
27032703
u64 *qgroup_reserved, bool use_global_rsv);
27042704
void btrfs_subvolume_release_metadata(struct btrfs_fs_info *fs_info,
27052705
struct btrfs_block_rsv *rsv);
2706-
int btrfs_delalloc_reserve_metadata(struct inode *inode, u64 num_bytes);
2707-
void btrfs_delalloc_release_metadata(struct inode *inode, u64 num_bytes);
2706+
int btrfs_delalloc_reserve_metadata(struct btrfs_inode *inode, u64 num_bytes);
2707+
void btrfs_delalloc_release_metadata(struct btrfs_inode *inode, u64 num_bytes);
27082708
int btrfs_delalloc_reserve_space(struct inode *inode, u64 start, u64 len);
27092709
void btrfs_delalloc_release_space(struct inode *inode, u64 start, u64 len);
27102710
void btrfs_init_block_rsv(struct btrfs_block_rsv *rsv, unsigned short type);
@@ -2982,7 +2982,7 @@ int btrfs_check_dir_item_collision(struct btrfs_root *root, u64 dir,
29822982
const char *name, int name_len);
29832983
int btrfs_insert_dir_item(struct btrfs_trans_handle *trans,
29842984
struct btrfs_root *root, const char *name,
2985-
int name_len, struct inode *dir,
2985+
int name_len, struct btrfs_inode *dir,
29862986
struct btrfs_key *location, u8 type, u64 index);
29872987
struct btrfs_dir_item *btrfs_lookup_dir_item(struct btrfs_trans_handle *trans,
29882988
struct btrfs_root *root,
@@ -3081,7 +3081,7 @@ int btrfs_csum_one_bio(struct inode *inode, struct bio *bio,
30813081
u64 file_start, int contig);
30823082
int btrfs_lookup_csums_range(struct btrfs_root *root, u64 start, u64 end,
30833083
struct list_head *list, int search_commit);
3084-
void btrfs_extent_item_to_extent_map(struct inode *inode,
3084+
void btrfs_extent_item_to_extent_map(struct btrfs_inode *inode,
30853085
const struct btrfs_path *path,
30863086
struct btrfs_file_extent_item *fi,
30873087
const bool new_inline,
@@ -3100,9 +3100,9 @@ struct btrfs_delalloc_work *btrfs_alloc_delalloc_work(struct inode *inode,
31003100
int delay_iput);
31013101
void btrfs_wait_and_free_delalloc_work(struct btrfs_delalloc_work *work);
31023102

3103-
struct extent_map *btrfs_get_extent_fiemap(struct inode *inode, struct page *page,
3104-
size_t pg_offset, u64 start, u64 len,
3105-
int create);
3103+
struct extent_map *btrfs_get_extent_fiemap(struct btrfs_inode *inode,
3104+
struct page *page, size_t pg_offset, u64 start,
3105+
u64 len, int create);
31063106
noinline int can_nocow_extent(struct inode *inode, u64 offset, u64 *len,
31073107
u64 *orig_start, u64 *orig_block_len,
31083108
u64 *ram_bytes);
@@ -3123,13 +3123,13 @@ static inline void btrfs_force_ra(struct address_space *mapping,
31233123
}
31243124

31253125
struct inode *btrfs_lookup_dentry(struct inode *dir, struct dentry *dentry);
3126-
int btrfs_set_inode_index(struct inode *dir, u64 *index);
3126+
int btrfs_set_inode_index(struct btrfs_inode *dir, u64 *index);
31273127
int btrfs_unlink_inode(struct btrfs_trans_handle *trans,
31283128
struct btrfs_root *root,
31293129
struct btrfs_inode *dir, struct btrfs_inode *inode,
31303130
const char *name, int name_len);
31313131
int btrfs_add_link(struct btrfs_trans_handle *trans,
3132-
struct inode *parent_inode, struct inode *inode,
3132+
struct btrfs_inode *parent_inode, struct btrfs_inode *inode,
31333133
const char *name, int name_len, int add_backref, u64 index);
31343134
int btrfs_unlink_subvol(struct btrfs_trans_handle *trans,
31353135
struct btrfs_root *root,
@@ -3166,15 +3166,16 @@ void btrfs_destroy_cachep(void);
31663166
long btrfs_ioctl_trans_end(struct file *file);
31673167
struct inode *btrfs_iget(struct super_block *s, struct btrfs_key *location,
31683168
struct btrfs_root *root, int *was_new);
3169-
struct extent_map *btrfs_get_extent(struct inode *inode, struct page *page,
3170-
size_t pg_offset, u64 start, u64 end,
3171-
int create);
3169+
struct extent_map *btrfs_get_extent(struct btrfs_inode *inode,
3170+
struct page *page, size_t pg_offset,
3171+
u64 start, u64 end, int create);
31723172
int btrfs_update_inode(struct btrfs_trans_handle *trans,
31733173
struct btrfs_root *root,
31743174
struct inode *inode);
31753175
int btrfs_update_inode_fallback(struct btrfs_trans_handle *trans,
31763176
struct btrfs_root *root, struct inode *inode);
3177-
int btrfs_orphan_add(struct btrfs_trans_handle *trans, struct inode *inode);
3177+
int btrfs_orphan_add(struct btrfs_trans_handle *trans,
3178+
struct btrfs_inode *inode);
31783179
int btrfs_orphan_cleanup(struct btrfs_root *root);
31793180
void btrfs_orphan_commit_root(struct btrfs_trans_handle *trans,
31803181
struct btrfs_root *root);
@@ -3215,11 +3216,11 @@ ssize_t btrfs_dedupe_file_range(struct file *src_file, u64 loff, u64 olen,
32153216
int btrfs_auto_defrag_init(void);
32163217
void btrfs_auto_defrag_exit(void);
32173218
int btrfs_add_inode_defrag(struct btrfs_trans_handle *trans,
3218-
struct inode *inode);
3219+
struct btrfs_inode *inode);
32193220
int btrfs_run_defrag_inodes(struct btrfs_fs_info *fs_info);
32203221
void btrfs_cleanup_defrag_inodes(struct btrfs_fs_info *fs_info);
32213222
int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync);
3222-
void btrfs_drop_extent_cache(struct inode *inode, u64 start, u64 end,
3223+
void btrfs_drop_extent_cache(struct btrfs_inode *inode, u64 start, u64 end,
32233224
int skip_pinned);
32243225
extern const struct file_operations btrfs_file_operations;
32253226
int __btrfs_drop_extents(struct btrfs_trans_handle *trans,
@@ -3233,7 +3234,7 @@ int btrfs_drop_extents(struct btrfs_trans_handle *trans,
32333234
struct btrfs_root *root, struct inode *inode, u64 start,
32343235
u64 end, int drop_cache);
32353236
int btrfs_mark_extent_written(struct btrfs_trans_handle *trans,
3236-
struct inode *inode, u64 start, u64 end);
3237+
struct btrfs_inode *inode, u64 start, u64 end);
32373238
int btrfs_release_file(struct inode *inode, struct file *file);
32383239
int btrfs_dirty_pages(struct inode *inode, struct page **pages,
32393240
size_t num_pages, loff_t pos, size_t write_bytes,

fs/btrfs/delayed-inode.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1790,7 +1790,7 @@ int btrfs_fill_inode(struct inode *inode, u32 *rdev)
17901790

17911791
i_uid_write(inode, btrfs_stack_inode_uid(inode_item));
17921792
i_gid_write(inode, btrfs_stack_inode_gid(inode_item));
1793-
btrfs_i_size_write(inode, btrfs_stack_inode_size(inode_item));
1793+
btrfs_i_size_write(BTRFS_I(inode), btrfs_stack_inode_size(inode_item));
17941794
inode->i_mode = btrfs_stack_inode_mode(inode_item);
17951795
set_nlink(inode, btrfs_stack_inode_nlink(inode_item));
17961796
inode_set_bytes(inode, btrfs_stack_inode_nbytes(inode_item));

fs/btrfs/dev-replace.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,8 +304,9 @@ void btrfs_after_dev_replace_commit(struct btrfs_fs_info *fs_info)
304304
dev_replace->cursor_left_last_write_of_item;
305305
}
306306

307-
int btrfs_dev_replace_start(struct btrfs_fs_info *fs_info, char *tgtdev_name,
308-
u64 srcdevid, char *srcdev_name, int read_src)
307+
int btrfs_dev_replace_start(struct btrfs_fs_info *fs_info,
308+
const char *tgtdev_name, u64 srcdevid, const char *srcdev_name,
309+
int read_src)
309310
{
310311
struct btrfs_root *root = fs_info->dev_root;
311312
struct btrfs_trans_handle *trans;

fs/btrfs/dev-replace.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,9 @@ int btrfs_run_dev_replace(struct btrfs_trans_handle *trans,
2727
void btrfs_after_dev_replace_commit(struct btrfs_fs_info *fs_info);
2828
int btrfs_dev_replace_by_ioctl(struct btrfs_fs_info *fs_info,
2929
struct btrfs_ioctl_dev_replace_args *args);
30-
int btrfs_dev_replace_start(struct btrfs_fs_info *fs_info, char *tgtdev_name,
31-
u64 srcdevid, char *srcdev_name, int read_src);
30+
int btrfs_dev_replace_start(struct btrfs_fs_info *fs_info,
31+
const char *tgtdev_name, u64 srcdevid, const char *srcdev_name,
32+
int read_src);
3233
void btrfs_dev_replace_status(struct btrfs_fs_info *fs_info,
3334
struct btrfs_ioctl_dev_replace_args *args);
3435
int btrfs_dev_replace_cancel(struct btrfs_fs_info *fs_info,

0 commit comments

Comments
 (0)