LCOV - code coverage report
Current view: top level - include/linux - blockgroup_lock.h (source / functions) Hit Total Coverage
Test: fstests of 6.5.0-rc3-djwa @ Mon Jul 31 20:08:17 PDT 2023 Lines: 0 6 0.0 %
Date: 2023-07-31 20:08:17 Functions: 0 1 0.0 %

          Line data    Source code
       1             : /* SPDX-License-Identifier: GPL-2.0 */
       2             : #ifndef _LINUX_BLOCKGROUP_LOCK_H
       3             : #define _LINUX_BLOCKGROUP_LOCK_H
       4             : /*
       5             :  * Per-blockgroup locking for ext2 and ext3.
       6             :  *
       7             :  * Simple hashed spinlocking.
       8             :  */
       9             : 
      10             : #include <linux/spinlock.h>
      11             : #include <linux/cache.h>
      12             : 
      13             : #ifdef CONFIG_SMP
      14             : #define NR_BG_LOCKS     (4 << ilog2(NR_CPUS < 32 ? NR_CPUS : 32))
      15             : #else
      16             : #define NR_BG_LOCKS     1
      17             : #endif
      18             : 
      19             : struct bgl_lock {
      20             :         spinlock_t lock;
      21             : } ____cacheline_aligned_in_smp;
      22             : 
      23             : struct blockgroup_lock {
      24             :         struct bgl_lock locks[NR_BG_LOCKS];
      25             : };
      26             : 
      27           0 : static inline void bgl_lock_init(struct blockgroup_lock *bgl)
      28             : {
      29           0 :         int i;
      30             : 
      31           0 :         for (i = 0; i < NR_BG_LOCKS; i++)
      32           0 :                 spin_lock_init(&bgl->locks[i].lock);
      33           0 : }
      34             : 
      35             : static inline spinlock_t *
      36             : bgl_lock_ptr(struct blockgroup_lock *bgl, unsigned int block_group)
      37             : {
      38           0 :         return &bgl->locks[block_group & (NR_BG_LOCKS-1)].lock;
      39             : }
      40             : 
      41             : #endif

Generated by: LCOV version 1.14