@@ -331,26 +331,6 @@ struct tree_mod_elem {
331
331
struct tree_mod_root old_root ;
332
332
};
333
333
334
- static inline void tree_mod_log_read_lock (struct btrfs_fs_info * fs_info )
335
- {
336
- read_lock (& fs_info -> tree_mod_log_lock );
337
- }
338
-
339
- static inline void tree_mod_log_read_unlock (struct btrfs_fs_info * fs_info )
340
- {
341
- read_unlock (& fs_info -> tree_mod_log_lock );
342
- }
343
-
344
- static inline void tree_mod_log_write_lock (struct btrfs_fs_info * fs_info )
345
- {
346
- write_lock (& fs_info -> tree_mod_log_lock );
347
- }
348
-
349
- static inline void tree_mod_log_write_unlock (struct btrfs_fs_info * fs_info )
350
- {
351
- write_unlock (& fs_info -> tree_mod_log_lock );
352
- }
353
-
354
334
/*
355
335
* Pull a new tree mod seq number for our operation.
356
336
*/
@@ -370,14 +350,14 @@ static inline u64 btrfs_inc_tree_mod_seq(struct btrfs_fs_info *fs_info)
370
350
u64 btrfs_get_tree_mod_seq (struct btrfs_fs_info * fs_info ,
371
351
struct seq_list * elem )
372
352
{
373
- tree_mod_log_write_lock ( fs_info );
353
+ write_lock ( & fs_info -> tree_mod_log_lock );
374
354
spin_lock (& fs_info -> tree_mod_seq_lock );
375
355
if (!elem -> seq ) {
376
356
elem -> seq = btrfs_inc_tree_mod_seq (fs_info );
377
357
list_add_tail (& elem -> list , & fs_info -> tree_mod_seq_list );
378
358
}
379
359
spin_unlock (& fs_info -> tree_mod_seq_lock );
380
- tree_mod_log_write_unlock ( fs_info );
360
+ write_unlock ( & fs_info -> tree_mod_log_lock );
381
361
382
362
return elem -> seq ;
383
363
}
@@ -419,7 +399,7 @@ void btrfs_put_tree_mod_seq(struct btrfs_fs_info *fs_info,
419
399
* anything that's lower than the lowest existing (read: blocked)
420
400
* sequence number can be removed from the tree.
421
401
*/
422
- tree_mod_log_write_lock ( fs_info );
402
+ write_lock ( & fs_info -> tree_mod_log_lock );
423
403
tm_root = & fs_info -> tree_mod_log ;
424
404
for (node = rb_first (tm_root ); node ; node = next ) {
425
405
next = rb_next (node );
@@ -429,7 +409,7 @@ void btrfs_put_tree_mod_seq(struct btrfs_fs_info *fs_info,
429
409
rb_erase (node , tm_root );
430
410
kfree (tm );
431
411
}
432
- tree_mod_log_write_unlock ( fs_info );
412
+ write_unlock ( & fs_info -> tree_mod_log_lock );
433
413
}
434
414
435
415
/*
@@ -440,7 +420,7 @@ void btrfs_put_tree_mod_seq(struct btrfs_fs_info *fs_info,
440
420
* for root replace operations, or the logical address of the affected
441
421
* block for all other operations.
442
422
*
443
- * Note: must be called with write lock (tree_mod_log_write_lock) .
423
+ * Note: must be called with write lock for fs_info::tree_mod_log_lock .
444
424
*/
445
425
static noinline int
446
426
__tree_mod_log_insert (struct btrfs_fs_info * fs_info , struct tree_mod_elem * tm )
@@ -480,7 +460,7 @@ __tree_mod_log_insert(struct btrfs_fs_info *fs_info, struct tree_mod_elem *tm)
480
460
* Determines if logging can be omitted. Returns 1 if it can. Otherwise, it
481
461
* returns zero with the tree_mod_log_lock acquired. The caller must hold
482
462
* this until all tree mod log insertions are recorded in the rb tree and then
483
- * call tree_mod_log_write_unlock() to release .
463
+ * write unlock fs_info::tree_mod_log_lock .
484
464
*/
485
465
static inline int tree_mod_dont_log (struct btrfs_fs_info * fs_info ,
486
466
struct extent_buffer * eb ) {
@@ -490,9 +470,9 @@ static inline int tree_mod_dont_log(struct btrfs_fs_info *fs_info,
490
470
if (eb && btrfs_header_level (eb ) == 0 )
491
471
return 1 ;
492
472
493
- tree_mod_log_write_lock ( fs_info );
473
+ write_lock ( & fs_info -> tree_mod_log_lock );
494
474
if (list_empty (& (fs_info )-> tree_mod_seq_list )) {
495
- tree_mod_log_write_unlock ( fs_info );
475
+ write_unlock ( & fs_info -> tree_mod_log_lock );
496
476
return 1 ;
497
477
}
498
478
@@ -556,7 +536,7 @@ tree_mod_log_insert_key(struct btrfs_fs_info *fs_info,
556
536
}
557
537
558
538
ret = __tree_mod_log_insert (fs_info , tm );
559
- tree_mod_log_write_unlock ( fs_info );
539
+ write_unlock ( & eb -> fs_info -> tree_mod_log_lock );
560
540
if (ret )
561
541
kfree (tm );
562
542
@@ -620,7 +600,7 @@ tree_mod_log_insert_move(struct btrfs_fs_info *fs_info,
620
600
ret = __tree_mod_log_insert (fs_info , tm );
621
601
if (ret )
622
602
goto free_tms ;
623
- tree_mod_log_write_unlock ( fs_info );
603
+ write_unlock ( & eb -> fs_info -> tree_mod_log_lock );
624
604
kfree (tm_list );
625
605
626
606
return 0 ;
@@ -631,7 +611,7 @@ tree_mod_log_insert_move(struct btrfs_fs_info *fs_info,
631
611
kfree (tm_list [i ]);
632
612
}
633
613
if (locked )
634
- tree_mod_log_write_unlock ( fs_info );
614
+ write_unlock ( & eb -> fs_info -> tree_mod_log_lock );
635
615
kfree (tm_list );
636
616
kfree (tm );
637
617
@@ -712,7 +692,7 @@ tree_mod_log_insert_root(struct btrfs_fs_info *fs_info,
712
692
if (!ret )
713
693
ret = __tree_mod_log_insert (fs_info , tm );
714
694
715
- tree_mod_log_write_unlock ( fs_info );
695
+ write_unlock ( & fs_info -> tree_mod_log_lock );
716
696
if (ret )
717
697
goto free_tms ;
718
698
kfree (tm_list );
@@ -739,7 +719,7 @@ __tree_mod_log_search(struct btrfs_fs_info *fs_info, u64 start, u64 min_seq,
739
719
struct tree_mod_elem * cur = NULL ;
740
720
struct tree_mod_elem * found = NULL ;
741
721
742
- tree_mod_log_read_lock ( fs_info );
722
+ read_lock ( & fs_info -> tree_mod_log_lock );
743
723
tm_root = & fs_info -> tree_mod_log ;
744
724
node = tm_root -> rb_node ;
745
725
while (node ) {
@@ -767,7 +747,7 @@ __tree_mod_log_search(struct btrfs_fs_info *fs_info, u64 start, u64 min_seq,
767
747
break ;
768
748
}
769
749
}
770
- tree_mod_log_read_unlock ( fs_info );
750
+ read_unlock ( & fs_info -> tree_mod_log_lock );
771
751
772
752
return found ;
773
753
}
@@ -848,7 +828,7 @@ tree_mod_log_eb_copy(struct btrfs_fs_info *fs_info, struct extent_buffer *dst,
848
828
goto free_tms ;
849
829
}
850
830
851
- tree_mod_log_write_unlock ( fs_info );
831
+ write_unlock ( & fs_info -> tree_mod_log_lock );
852
832
kfree (tm_list );
853
833
854
834
return 0 ;
@@ -860,7 +840,7 @@ tree_mod_log_eb_copy(struct btrfs_fs_info *fs_info, struct extent_buffer *dst,
860
840
kfree (tm_list [i ]);
861
841
}
862
842
if (locked )
863
- tree_mod_log_write_unlock ( fs_info );
843
+ write_unlock ( & fs_info -> tree_mod_log_lock );
864
844
kfree (tm_list );
865
845
866
846
return ret ;
@@ -920,7 +900,7 @@ tree_mod_log_free_eb(struct btrfs_fs_info *fs_info, struct extent_buffer *eb)
920
900
goto free_tms ;
921
901
922
902
ret = __tree_mod_log_free_eb (fs_info , tm_list , nritems );
923
- tree_mod_log_write_unlock ( fs_info );
903
+ write_unlock ( & eb -> fs_info -> tree_mod_log_lock );
924
904
if (ret )
925
905
goto free_tms ;
926
906
kfree (tm_list );
@@ -1271,7 +1251,7 @@ __tree_mod_log_rewind(struct btrfs_fs_info *fs_info, struct extent_buffer *eb,
1271
1251
unsigned long p_size = sizeof (struct btrfs_key_ptr );
1272
1252
1273
1253
n = btrfs_header_nritems (eb );
1274
- tree_mod_log_read_lock ( fs_info );
1254
+ read_lock ( & fs_info -> tree_mod_log_lock );
1275
1255
while (tm && tm -> seq >= time_seq ) {
1276
1256
/*
1277
1257
* all the operations are recorded with the operator used for
@@ -1326,7 +1306,7 @@ __tree_mod_log_rewind(struct btrfs_fs_info *fs_info, struct extent_buffer *eb,
1326
1306
if (tm -> logical != first_tm -> logical )
1327
1307
break ;
1328
1308
}
1329
- tree_mod_log_read_unlock ( fs_info );
1309
+ read_unlock ( & fs_info -> tree_mod_log_lock );
1330
1310
btrfs_set_header_nritems (eb , n );
1331
1311
}
1332
1312
0 commit comments