@@ -209,7 +209,7 @@ int btree_readahead_hook(struct extent_buffer *eb, int err)
209
209
/* find extent */
210
210
spin_lock (& fs_info -> reada_lock );
211
211
re = radix_tree_lookup (& fs_info -> reada_tree ,
212
- eb -> start >> PAGE_SHIFT );
212
+ eb -> start >> fs_info -> sectorsize_bits );
213
213
if (re )
214
214
re -> refcnt ++ ;
215
215
spin_unlock (& fs_info -> reada_lock );
@@ -240,7 +240,7 @@ static struct reada_zone *reada_find_zone(struct btrfs_device *dev, u64 logical,
240
240
zone = NULL ;
241
241
spin_lock (& fs_info -> reada_lock );
242
242
ret = radix_tree_gang_lookup (& dev -> reada_zones , (void * * )& zone ,
243
- logical >> PAGE_SHIFT , 1 );
243
+ logical >> fs_info -> sectorsize_bits , 1 );
244
244
if (ret == 1 && logical >= zone -> start && logical <= zone -> end ) {
245
245
kref_get (& zone -> refcnt );
246
246
spin_unlock (& fs_info -> reada_lock );
@@ -283,13 +283,13 @@ static struct reada_zone *reada_find_zone(struct btrfs_device *dev, u64 logical,
283
283
284
284
spin_lock (& fs_info -> reada_lock );
285
285
ret = radix_tree_insert (& dev -> reada_zones ,
286
- (unsigned long )(zone -> end >> PAGE_SHIFT ),
287
- zone );
286
+ (unsigned long )(zone -> end >> fs_info -> sectorsize_bits ),
287
+ zone );
288
288
289
289
if (ret == - EEXIST ) {
290
290
kfree (zone );
291
291
ret = radix_tree_gang_lookup (& dev -> reada_zones , (void * * )& zone ,
292
- logical >> PAGE_SHIFT , 1 );
292
+ logical >> fs_info -> sectorsize_bits , 1 );
293
293
if (ret == 1 && logical >= zone -> start && logical <= zone -> end )
294
294
kref_get (& zone -> refcnt );
295
295
else
@@ -315,7 +315,7 @@ static struct reada_extent *reada_find_extent(struct btrfs_fs_info *fs_info,
315
315
u64 length ;
316
316
int real_stripes ;
317
317
int nzones = 0 ;
318
- unsigned long index = logical >> PAGE_SHIFT ;
318
+ unsigned long index = logical >> fs_info -> sectorsize_bits ;
319
319
int dev_replace_is_ongoing ;
320
320
int have_zone = 0 ;
321
321
@@ -497,7 +497,7 @@ static void reada_extent_put(struct btrfs_fs_info *fs_info,
497
497
struct reada_extent * re )
498
498
{
499
499
int i ;
500
- unsigned long index = re -> logical >> PAGE_SHIFT ;
500
+ unsigned long index = re -> logical >> fs_info -> sectorsize_bits ;
501
501
502
502
spin_lock (& fs_info -> reada_lock );
503
503
if (-- re -> refcnt ) {
@@ -538,11 +538,12 @@ static void reada_extent_put(struct btrfs_fs_info *fs_info,
538
538
static void reada_zone_release (struct kref * kref )
539
539
{
540
540
struct reada_zone * zone = container_of (kref , struct reada_zone , refcnt );
541
+ struct btrfs_fs_info * fs_info = zone -> device -> fs_info ;
541
542
542
- lockdep_assert_held (& zone -> device -> fs_info -> reada_lock );
543
+ lockdep_assert_held (& fs_info -> reada_lock );
543
544
544
545
radix_tree_delete (& zone -> device -> reada_zones ,
545
- zone -> end >> PAGE_SHIFT );
546
+ zone -> end >> fs_info -> sectorsize_bits );
546
547
547
548
kfree (zone );
548
549
}
@@ -593,7 +594,7 @@ static int reada_add_block(struct reada_control *rc, u64 logical,
593
594
static void reada_peer_zones_set_lock (struct reada_zone * zone , int lock )
594
595
{
595
596
int i ;
596
- unsigned long index = zone -> end >> PAGE_SHIFT ;
597
+ unsigned long index = zone -> end >> zone -> device -> fs_info -> sectorsize_bits ;
597
598
598
599
for (i = 0 ; i < zone -> ndevs ; ++ i ) {
599
600
struct reada_zone * peer ;
@@ -628,7 +629,7 @@ static int reada_pick_zone(struct btrfs_device *dev)
628
629
(void * * )& zone , index , 1 );
629
630
if (ret == 0 )
630
631
break ;
631
- index = (zone -> end >> PAGE_SHIFT ) + 1 ;
632
+ index = (zone -> end >> dev -> fs_info -> sectorsize_bits ) + 1 ;
632
633
if (zone -> locked ) {
633
634
if (zone -> elems > top_locked_elems ) {
634
635
top_locked_elems = zone -> elems ;
@@ -709,7 +710,7 @@ static int reada_start_machine_dev(struct btrfs_device *dev)
709
710
* plugging to speed things up
710
711
*/
711
712
ret = radix_tree_gang_lookup (& dev -> reada_extents , (void * * )& re ,
712
- dev -> reada_next >> PAGE_SHIFT , 1 );
713
+ dev -> reada_next >> fs_info -> sectorsize_bits , 1 );
713
714
if (ret == 0 || re -> logical > dev -> reada_curr_zone -> end ) {
714
715
ret = reada_pick_zone (dev );
715
716
if (!ret ) {
@@ -718,7 +719,7 @@ static int reada_start_machine_dev(struct btrfs_device *dev)
718
719
}
719
720
re = NULL ;
720
721
ret = radix_tree_gang_lookup (& dev -> reada_extents , (void * * )& re ,
721
- dev -> reada_next >> PAGE_SHIFT , 1 );
722
+ dev -> reada_next >> fs_info -> sectorsize_bits , 1 );
722
723
}
723
724
if (ret == 0 ) {
724
725
spin_unlock (& fs_info -> reada_lock );
@@ -885,7 +886,7 @@ static void dump_devs(struct btrfs_fs_info *fs_info, int all)
885
886
pr_cont (" curr off %llu" ,
886
887
device -> reada_next - zone -> start );
887
888
pr_cont ("\n" );
888
- index = (zone -> end >> PAGE_SHIFT ) + 1 ;
889
+ index = (zone -> end >> fs_info -> sectorsize_bits ) + 1 ;
889
890
}
890
891
cnt = 0 ;
891
892
index = 0 ;
@@ -910,7 +911,7 @@ static void dump_devs(struct btrfs_fs_info *fs_info, int all)
910
911
}
911
912
}
912
913
pr_cont ("\n" );
913
- index = (re -> logical >> PAGE_SHIFT ) + 1 ;
914
+ index = (re -> logical >> fs_info -> sectorsize_bits ) + 1 ;
914
915
if (++ cnt > 15 )
915
916
break ;
916
917
}
@@ -926,7 +927,7 @@ static void dump_devs(struct btrfs_fs_info *fs_info, int all)
926
927
if (ret == 0 )
927
928
break ;
928
929
if (!re -> scheduled ) {
929
- index = (re -> logical >> PAGE_SHIFT ) + 1 ;
930
+ index = (re -> logical >> fs_info -> sectorsize_bits ) + 1 ;
930
931
continue ;
931
932
}
932
933
pr_debug ("re: logical %llu size %u list empty %d scheduled %d" ,
@@ -942,7 +943,7 @@ static void dump_devs(struct btrfs_fs_info *fs_info, int all)
942
943
}
943
944
}
944
945
pr_cont ("\n" );
945
- index = (re -> logical >> PAGE_SHIFT ) + 1 ;
946
+ index = (re -> logical >> fs_info -> sectorsize_bits ) + 1 ;
946
947
}
947
948
spin_unlock (& fs_info -> reada_lock );
948
949
}
0 commit comments