@@ -736,7 +736,7 @@ int wnd_set_free(struct wnd_bitmap *wnd, size_t bit, size_t bits)
736
736
737
737
lock_buffer (bh );
738
738
739
- __bitmap_clear (buf , wbit , op );
739
+ ntfs_bitmap_clear_le (buf , wbit , op );
740
740
741
741
wnd -> free_bits [iw ] += op ;
742
742
@@ -788,7 +788,7 @@ int wnd_set_used(struct wnd_bitmap *wnd, size_t bit, size_t bits)
788
788
789
789
lock_buffer (bh );
790
790
791
- __bitmap_set (buf , wbit , op );
791
+ ntfs_bitmap_set_le (buf , wbit , op );
792
792
wnd -> free_bits [iw ] -= op ;
793
793
794
794
set_buffer_uptodate (bh );
@@ -1363,7 +1363,7 @@ int wnd_extend(struct wnd_bitmap *wnd, size_t new_bits)
1363
1363
lock_buffer (bh );
1364
1364
buf = (ulong * )bh -> b_data ;
1365
1365
1366
- __bitmap_clear (buf , b0 , blocksize * 8 - b0 );
1366
+ ntfs_bitmap_clear_le (buf , b0 , blocksize * 8 - b0 );
1367
1367
frb = wbits - __bitmap_weight (buf , wbits );
1368
1368
wnd -> total_zeroes += frb - wnd -> free_bits [iw ];
1369
1369
wnd -> free_bits [iw ] = frb ;
@@ -1481,3 +1481,43 @@ int ntfs_trim_fs(struct ntfs_sb_info *sbi, struct fstrim_range *range)
1481
1481
1482
1482
return err ;
1483
1483
}
1484
+
1485
+ void ntfs_bitmap_set_le (unsigned long * map , unsigned int start , int len )
1486
+ {
1487
+ unsigned long * p = map + BIT_WORD (start );
1488
+ const unsigned int size = start + len ;
1489
+ int bits_to_set = BITS_PER_LONG - (start % BITS_PER_LONG );
1490
+ unsigned long mask_to_set = cpu_to_le32 (BITMAP_FIRST_WORD_MASK (start ));
1491
+
1492
+ while (len - bits_to_set >= 0 ) {
1493
+ * p |= mask_to_set ;
1494
+ len -= bits_to_set ;
1495
+ bits_to_set = BITS_PER_LONG ;
1496
+ mask_to_set = ~0UL ;
1497
+ p ++ ;
1498
+ }
1499
+ if (len ) {
1500
+ mask_to_set &= cpu_to_le32 (BITMAP_LAST_WORD_MASK (size ));
1501
+ * p |= mask_to_set ;
1502
+ }
1503
+ }
1504
+
1505
+ void ntfs_bitmap_clear_le (unsigned long * map , unsigned int start , int len )
1506
+ {
1507
+ unsigned long * p = map + BIT_WORD (start );
1508
+ const unsigned int size = start + len ;
1509
+ int bits_to_clear = BITS_PER_LONG - (start % BITS_PER_LONG );
1510
+ unsigned long mask_to_clear = cpu_to_le32 (BITMAP_FIRST_WORD_MASK (start ));
1511
+
1512
+ while (len - bits_to_clear >= 0 ) {
1513
+ * p &= ~mask_to_clear ;
1514
+ len -= bits_to_clear ;
1515
+ bits_to_clear = BITS_PER_LONG ;
1516
+ mask_to_clear = ~0UL ;
1517
+ p ++ ;
1518
+ }
1519
+ if (len ) {
1520
+ mask_to_clear &= cpu_to_le32 (BITMAP_LAST_WORD_MASK (size ));
1521
+ * p &= ~mask_to_clear ;
1522
+ }
1523
+ }
0 commit comments