@@ -143,7 +143,7 @@ struct btrfs_subpage *btrfs_alloc_subpage(const struct btrfs_fs_info *fs_info,
143
143
if (type == BTRFS_SUBPAGE_METADATA )
144
144
atomic_set (& ret -> eb_refs , 0 );
145
145
else
146
- atomic_set (& ret -> writers , 0 );
146
+ atomic_set (& ret -> nr_locked , 0 );
147
147
return ret ;
148
148
}
149
149
@@ -237,8 +237,8 @@ static void btrfs_subpage_clamp_range(struct folio *folio, u64 *start, u32 *len)
237
237
orig_start + orig_len ) - * start ;
238
238
}
239
239
240
- static bool btrfs_subpage_end_and_test_writer (const struct btrfs_fs_info * fs_info ,
241
- struct folio * folio , u64 start , u32 len )
240
+ static bool btrfs_subpage_end_and_test_lock (const struct btrfs_fs_info * fs_info ,
241
+ struct folio * folio , u64 start , u32 len )
242
242
{
243
243
struct btrfs_subpage * subpage = folio_get_private (folio );
244
244
const int start_bit = subpage_calc_start_bit (fs_info , folio , locked , start , len );
@@ -256,9 +256,9 @@ static bool btrfs_subpage_end_and_test_writer(const struct btrfs_fs_info *fs_inf
256
256
* extent_clear_unlock_delalloc() for compression path.
257
257
*
258
258
* This @locked_page is locked by plain lock_page(), thus its
259
- * subpage::writers is 0. Handle them in a special way.
259
+ * subpage::locked is 0. Handle them in a special way.
260
260
*/
261
- if (atomic_read (& subpage -> writers ) == 0 ) {
261
+ if (atomic_read (& subpage -> nr_locked ) == 0 ) {
262
262
spin_unlock_irqrestore (& subpage -> lock , flags );
263
263
return true;
264
264
}
@@ -267,8 +267,8 @@ static bool btrfs_subpage_end_and_test_writer(const struct btrfs_fs_info *fs_inf
267
267
clear_bit (bit , subpage -> bitmaps );
268
268
cleared ++ ;
269
269
}
270
- ASSERT (atomic_read (& subpage -> writers ) >= cleared );
271
- last = atomic_sub_and_test (cleared , & subpage -> writers );
270
+ ASSERT (atomic_read (& subpage -> nr_locked ) >= cleared );
271
+ last = atomic_sub_and_test (cleared , & subpage -> nr_locked );
272
272
spin_unlock_irqrestore (& subpage -> lock , flags );
273
273
return last ;
274
274
}
@@ -289,8 +289,8 @@ static bool btrfs_subpage_end_and_test_writer(const struct btrfs_fs_info *fs_inf
289
289
* bitmap, reduce the writer lock number, and unlock the page if that's
290
290
* the last locked range.
291
291
*/
292
- void btrfs_folio_end_writer_lock (const struct btrfs_fs_info * fs_info ,
293
- struct folio * folio , u64 start , u32 len )
292
+ void btrfs_folio_end_lock (const struct btrfs_fs_info * fs_info ,
293
+ struct folio * folio , u64 start , u32 len )
294
294
{
295
295
struct btrfs_subpage * subpage = folio_get_private (folio );
296
296
@@ -303,24 +303,24 @@ void btrfs_folio_end_writer_lock(const struct btrfs_fs_info *fs_info,
303
303
304
304
/*
305
305
* For subpage case, there are two types of locked page. With or
306
- * without writers number.
306
+ * without locked number.
307
307
*
308
- * Since we own the page lock, no one else could touch subpage::writers
308
+ * Since we own the page lock, no one else could touch subpage::locked
309
309
* and we are safe to do several atomic operations without spinlock.
310
310
*/
311
- if (atomic_read (& subpage -> writers ) == 0 ) {
312
- /* No writers , locked by plain lock_page(). */
311
+ if (atomic_read (& subpage -> nr_locked ) == 0 ) {
312
+ /* No subpage lock , locked by plain lock_page(). */
313
313
folio_unlock (folio );
314
314
return ;
315
315
}
316
316
317
317
btrfs_subpage_clamp_range (folio , & start , & len );
318
- if (btrfs_subpage_end_and_test_writer (fs_info , folio , start , len ))
318
+ if (btrfs_subpage_end_and_test_lock (fs_info , folio , start , len ))
319
319
folio_unlock (folio );
320
320
}
321
321
322
- void btrfs_folio_end_writer_lock_bitmap (const struct btrfs_fs_info * fs_info ,
323
- struct folio * folio , unsigned long bitmap )
322
+ void btrfs_folio_end_lock_bitmap (const struct btrfs_fs_info * fs_info ,
323
+ struct folio * folio , unsigned long bitmap )
324
324
{
325
325
struct btrfs_subpage * subpage = folio_get_private (folio );
326
326
const int start_bit = fs_info -> sectors_per_page * btrfs_bitmap_nr_locked ;
@@ -334,8 +334,8 @@ void btrfs_folio_end_writer_lock_bitmap(const struct btrfs_fs_info *fs_info,
334
334
return ;
335
335
}
336
336
337
- if (atomic_read (& subpage -> writers ) == 0 ) {
338
- /* No writers , locked by plain lock_page(). */
337
+ if (atomic_read (& subpage -> nr_locked ) == 0 ) {
338
+ /* No subpage lock , locked by plain lock_page(). */
339
339
folio_unlock (folio );
340
340
return ;
341
341
}
@@ -345,8 +345,8 @@ void btrfs_folio_end_writer_lock_bitmap(const struct btrfs_fs_info *fs_info,
345
345
if (test_and_clear_bit (bit + start_bit , subpage -> bitmaps ))
346
346
cleared ++ ;
347
347
}
348
- ASSERT (atomic_read (& subpage -> writers ) >= cleared );
349
- last = atomic_sub_and_test (cleared , & subpage -> writers );
348
+ ASSERT (atomic_read (& subpage -> nr_locked ) >= cleared );
349
+ last = atomic_sub_and_test (cleared , & subpage -> nr_locked );
350
350
spin_unlock_irqrestore (& subpage -> lock , flags );
351
351
if (last )
352
352
folio_unlock (folio );
@@ -671,8 +671,8 @@ void btrfs_folio_assert_not_dirty(const struct btrfs_fs_info *fs_info,
671
671
* This populates the involved subpage ranges so that subpage helpers can
672
672
* properly unlock them.
673
673
*/
674
- void btrfs_folio_set_writer_lock (const struct btrfs_fs_info * fs_info ,
675
- struct folio * folio , u64 start , u32 len )
674
+ void btrfs_folio_set_lock (const struct btrfs_fs_info * fs_info ,
675
+ struct folio * folio , u64 start , u32 len )
676
676
{
677
677
struct btrfs_subpage * subpage ;
678
678
unsigned long flags ;
@@ -691,7 +691,7 @@ void btrfs_folio_set_writer_lock(const struct btrfs_fs_info *fs_info,
691
691
/* Target range should not yet be locked. */
692
692
ASSERT (bitmap_test_range_all_zero (subpage -> bitmaps , start_bit , nbits ));
693
693
bitmap_set (subpage -> bitmaps , start_bit , nbits );
694
- ret = atomic_add_return (nbits , & subpage -> writers );
694
+ ret = atomic_add_return (nbits , & subpage -> nr_locked );
695
695
ASSERT (ret <= fs_info -> sectors_per_page );
696
696
spin_unlock_irqrestore (& subpage -> lock , flags );
697
697
}
0 commit comments