Skip to content

Commit a305810

Browse files
committed
Merge branch 'misc-for-4.5' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux into for-linus-4.5
2 parents 511711a + ee592d0 commit a305810

22 files changed

+186
-144
lines changed

fs/btrfs/btrfs_inode.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,10 @@ struct btrfs_inode {
192192
/* File creation time. */
193193
struct timespec i_otime;
194194

195+
/* Hook into fs_info->delayed_iputs */
196+
struct list_head delayed_iput;
197+
long delayed_iput_count;
198+
195199
struct inode vfs_inode;
196200
};
197201

fs/btrfs/ctree.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2248,7 +2248,6 @@ static void reada_for_search(struct btrfs_root *root,
22482248
u64 target;
22492249
u64 nread = 0;
22502250
u64 gen;
2251-
int direction = path->reada;
22522251
struct extent_buffer *eb;
22532252
u32 nr;
22542253
u32 blocksize;
@@ -2276,16 +2275,16 @@ static void reada_for_search(struct btrfs_root *root,
22762275
nr = slot;
22772276

22782277
while (1) {
2279-
if (direction < 0) {
2278+
if (path->reada == READA_BACK) {
22802279
if (nr == 0)
22812280
break;
22822281
nr--;
2283-
} else if (direction > 0) {
2282+
} else if (path->reada == READA_FORWARD) {
22842283
nr++;
22852284
if (nr >= nritems)
22862285
break;
22872286
}
2288-
if (path->reada < 0 && objectid) {
2287+
if (path->reada == READA_BACK && objectid) {
22892288
btrfs_node_key(node, &disk_key, nr);
22902289
if (btrfs_disk_key_objectid(&disk_key) != objectid)
22912290
break;
@@ -2493,7 +2492,7 @@ read_block_for_search(struct btrfs_trans_handle *trans,
24932492
btrfs_set_path_blocking(p);
24942493

24952494
free_extent_buffer(tmp);
2496-
if (p->reada)
2495+
if (p->reada != READA_NONE)
24972496
reada_for_search(root, p, level, slot, key->objectid);
24982497

24992498
btrfs_release_path(p);

fs/btrfs/ctree.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ struct btrfs_ordered_sum;
177177
/* csum types */
178178
#define BTRFS_CSUM_TYPE_CRC32 0
179179

180-
static int btrfs_csum_sizes[] = { 4 };
180+
static const int btrfs_csum_sizes[] = { 4 };
181181

182182
/* four bytes for CRC32 */
183183
#define BTRFS_EMPTY_DIR_SIZE 0
@@ -598,14 +598,15 @@ struct btrfs_node {
598598
* The slots array records the index of the item or block pointer
599599
* used while walking the tree.
600600
*/
601+
enum { READA_NONE = 0, READA_BACK, READA_FORWARD };
601602
struct btrfs_path {
602603
struct extent_buffer *nodes[BTRFS_MAX_LEVEL];
603604
int slots[BTRFS_MAX_LEVEL];
604605
/* if there is real range locking, this locks field will change */
605-
int locks[BTRFS_MAX_LEVEL];
606-
int reada;
606+
u8 locks[BTRFS_MAX_LEVEL];
607+
u8 reada;
607608
/* keep some upper locks as we walk down */
608-
int lowest_level;
609+
u8 lowest_level;
609610

610611
/*
611612
* set by btrfs_split_item, tells search_slot to keep all locks

fs/btrfs/delayed-ref.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -493,12 +493,12 @@ update_existing_head_ref(struct btrfs_delayed_ref_root *delayed_refs,
493493
memcpy(&existing_ref->extent_op->key,
494494
&ref->extent_op->key,
495495
sizeof(ref->extent_op->key));
496-
existing_ref->extent_op->update_key = 1;
496+
existing_ref->extent_op->update_key = true;
497497
}
498498
if (ref->extent_op->update_flags) {
499499
existing_ref->extent_op->flags_to_set |=
500500
ref->extent_op->flags_to_set;
501-
existing_ref->extent_op->update_flags = 1;
501+
existing_ref->extent_op->update_flags = true;
502502
}
503503
btrfs_free_delayed_extent_op(ref->extent_op);
504504
}

fs/btrfs/delayed-ref.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,11 @@ struct btrfs_delayed_ref_node {
7575

7676
struct btrfs_delayed_extent_op {
7777
struct btrfs_disk_key key;
78+
u8 level;
79+
bool update_key;
80+
bool update_flags;
81+
bool is_data;
7882
u64 flags_to_set;
79-
int level;
80-
unsigned int update_key:1;
81-
unsigned int update_flags:1;
82-
unsigned int is_data:1;
8383
};
8484

8585
/*

fs/btrfs/disk-io.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2682,6 +2682,7 @@ int open_ctree(struct super_block *sb,
26822682
if (btrfs_check_super_csum(bh->b_data)) {
26832683
printk(KERN_ERR "BTRFS: superblock checksum mismatch\n");
26842684
err = -EINVAL;
2685+
brelse(bh);
26852686
goto fail_alloc;
26862687
}
26872688

fs/btrfs/extent-tree.c

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ static int load_extent_tree_free(struct btrfs_caching_control *caching_ctl)
437437
*/
438438
path->skip_locking = 1;
439439
path->search_commit_root = 1;
440-
path->reada = 1;
440+
path->reada = READA_FORWARD;
441441

442442
key.objectid = last;
443443
key.offset = 0;
@@ -2131,7 +2131,7 @@ static int __btrfs_inc_extent_ref(struct btrfs_trans_handle *trans,
21312131
if (!path)
21322132
return -ENOMEM;
21332133

2134-
path->reada = 1;
2134+
path->reada = READA_FORWARD;
21352135
path->leave_spinning = 1;
21362136
/* this will setup the path even if it fails to insert the back ref */
21372137
ret = insert_inline_extent_backref(trans, fs_info->extent_root, path,
@@ -2157,7 +2157,7 @@ static int __btrfs_inc_extent_ref(struct btrfs_trans_handle *trans,
21572157
btrfs_mark_buffer_dirty(leaf);
21582158
btrfs_release_path(path);
21592159

2160-
path->reada = 1;
2160+
path->reada = READA_FORWARD;
21612161
path->leave_spinning = 1;
21622162
/* now insert the actual backref */
21632163
ret = insert_extent_backref(trans, root->fs_info->extent_root,
@@ -2270,7 +2270,7 @@ static int run_delayed_extent_op(struct btrfs_trans_handle *trans,
22702270
}
22712271

22722272
again:
2273-
path->reada = 1;
2273+
path->reada = READA_FORWARD;
22742274
path->leave_spinning = 1;
22752275
ret = btrfs_search_slot(trans, root->fs_info->extent_root, &key,
22762276
path, 0, 1);
@@ -3007,9 +3007,9 @@ int btrfs_set_disk_extent_flags(struct btrfs_trans_handle *trans,
30073007
return -ENOMEM;
30083008

30093009
extent_op->flags_to_set = flags;
3010-
extent_op->update_flags = 1;
3011-
extent_op->update_key = 0;
3012-
extent_op->is_data = is_data ? 1 : 0;
3010+
extent_op->update_flags = true;
3011+
extent_op->update_key = false;
3012+
extent_op->is_data = is_data ? true : false;
30133013
extent_op->level = level;
30143014

30153015
ret = btrfs_add_delayed_extent_op(root->fs_info, trans, bytenr,
@@ -6472,7 +6472,7 @@ static int __btrfs_free_extent(struct btrfs_trans_handle *trans,
64726472
if (!path)
64736473
return -ENOMEM;
64746474

6475-
path->reada = 1;
6475+
path->reada = READA_FORWARD;
64766476
path->leave_spinning = 1;
64776477

64786478
is_data = owner_objectid >= BTRFS_FIRST_FREE_OBJECTID;
@@ -8031,12 +8031,9 @@ struct extent_buffer *btrfs_alloc_tree_block(struct btrfs_trans_handle *trans,
80318031
else
80328032
memset(&extent_op->key, 0, sizeof(extent_op->key));
80338033
extent_op->flags_to_set = flags;
8034-
if (skinny_metadata)
8035-
extent_op->update_key = 0;
8036-
else
8037-
extent_op->update_key = 1;
8038-
extent_op->update_flags = 1;
8039-
extent_op->is_data = 0;
8034+
extent_op->update_key = skinny_metadata ? false : true;
8035+
extent_op->update_flags = true;
8036+
extent_op->is_data = false;
80408037
extent_op->level = level;
80418038

80428039
ret = btrfs_add_delayed_tree_ref(root->fs_info, trans,
@@ -9745,7 +9742,7 @@ int btrfs_read_block_groups(struct btrfs_root *root)
97459742
path = btrfs_alloc_path();
97469743
if (!path)
97479744
return -ENOMEM;
9748-
path->reada = 1;
9745+
path->reada = READA_FORWARD;
97499746

97509747
cache_gen = btrfs_super_cache_generation(root->fs_info->super_copy);
97519748
if (btrfs_test_opt(root, SPACE_CACHE) &&

fs/btrfs/extent-tree.h

Whitespace-only changes.

fs/btrfs/file-item.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ static int __btrfs_lookup_bio_sums(struct btrfs_root *root,
202202
}
203203

204204
if (bio->bi_iter.bi_size > PAGE_CACHE_SIZE * 8)
205-
path->reada = 2;
205+
path->reada = READA_FORWARD;
206206

207207
WARN_ON(bio->bi_vcnt <= 0);
208208

@@ -328,7 +328,7 @@ int btrfs_lookup_csums_range(struct btrfs_root *root, u64 start, u64 end,
328328

329329
if (search_commit) {
330330
path->skip_locking = 1;
331-
path->reada = 2;
331+
path->reada = READA_FORWARD;
332332
path->search_commit_root = 1;
333333
}
334334

fs/btrfs/free-space-cache.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2016,7 +2016,7 @@ static bool use_bitmap(struct btrfs_free_space_ctl *ctl,
20162016
return true;
20172017
}
20182018

2019-
static struct btrfs_free_space_op free_space_op = {
2019+
static const struct btrfs_free_space_op free_space_op = {
20202020
.recalc_thresholds = recalculate_thresholds,
20212021
.use_bitmap = use_bitmap,
20222022
};

fs/btrfs/free-space-cache.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ struct btrfs_free_space_ctl {
3737
int total_bitmaps;
3838
int unit;
3939
u64 start;
40-
struct btrfs_free_space_op *op;
40+
const struct btrfs_free_space_op *op;
4141
void *private;
4242
struct mutex cache_writeout_mutex;
4343
struct list_head trimming_ranges;

fs/btrfs/inode-map.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ static int caching_kthread(void *data)
4848
/* Since the commit root is read-only, we can safely skip locking. */
4949
path->skip_locking = 1;
5050
path->search_commit_root = 1;
51-
path->reada = 2;
51+
path->reada = READA_FORWARD;
5252

5353
key.objectid = BTRFS_FIRST_FREE_OBJECTID;
5454
key.offset = 0;
@@ -334,7 +334,7 @@ static bool use_bitmap(struct btrfs_free_space_ctl *ctl,
334334
return true;
335335
}
336336

337-
static struct btrfs_free_space_op free_ino_op = {
337+
static const struct btrfs_free_space_op free_ino_op = {
338338
.recalc_thresholds = recalculate_thresholds,
339339
.use_bitmap = use_bitmap,
340340
};
@@ -356,7 +356,7 @@ static bool pinned_use_bitmap(struct btrfs_free_space_ctl *ctl,
356356
return false;
357357
}
358358

359-
static struct btrfs_free_space_op pinned_free_ino_op = {
359+
static const struct btrfs_free_space_op pinned_free_ino_op = {
360360
.recalc_thresholds = pinned_recalc_thresholds,
361361
.use_bitmap = pinned_use_bitmap,
362362
};

0 commit comments

Comments
 (0)