Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

dm block manager: make block locking optional

The block manager's locking is useful for catching cycles that may
result from certain btree metadata corruption. But in general it serves
as a developer tool to catch bugs in code. Unless you're finding that
DM thin provisioning is hanging due to infinite loops within the block
manager's access to btree nodes you can safely disable this feature.

Signed-off-by: Joe Thornber <ejt@redhat.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de> # do/while(0) macro fix
Signed-off-by: Mike Snitzer <snitzer@redhat.com>

authored by

Joe Thornber and committed by
Mike Snitzer
2e8ed711 a25f0944

+27 -2
+9 -1
drivers/md/Kconfig
··· 240 240 as a cache, holding recently-read blocks in memory and performing 241 241 delayed writes. 242 242 243 + config DM_DEBUG_BLOCK_MANAGER_LOCKING 244 + bool "Block manager locking" 245 + depends on DM_BUFIO 246 + ---help--- 247 + Block manager locking can catch various metadata corruption issues. 248 + 249 + If unsure, say N. 250 + 243 251 config DM_DEBUG_BLOCK_STACK_TRACING 244 252 bool "Keep stack trace of persistent data block lock holders" 245 - depends on STACKTRACE_SUPPORT && DM_BUFIO 253 + depends on STACKTRACE_SUPPORT && DM_DEBUG_BLOCK_MANAGER_LOCKING 246 254 select STACKTRACE 247 255 ---help--- 248 256 Enable this for messages that may help debug problems with the
+18 -1
drivers/md/persistent-data/dm-block-manager.c
··· 18 18 19 19 /*----------------------------------------------------------------*/ 20 20 21 + #ifdef CONFIG_DM_DEBUG_BLOCK_MANAGER_LOCKING 22 + 21 23 /* 22 24 * This is a read/write semaphore with a couple of differences. 23 25 * ··· 304 302 (unsigned long long) b); 305 303 } 306 304 305 + #else /* !CONFIG_DM_DEBUG_BLOCK_MANAGER_LOCKING */ 306 + 307 + #define bl_init(x) do { } while (0) 308 + #define bl_down_read(x) 0 309 + #define bl_down_read_nonblock(x) 0 310 + #define bl_up_read(x) do { } while (0) 311 + #define bl_down_write(x) 0 312 + #define bl_up_write(x) do { } while (0) 313 + #define report_recursive_bug(x, y) do { } while (0) 314 + 315 + #endif /* CONFIG_DM_DEBUG_BLOCK_MANAGER_LOCKING */ 316 + 307 317 /*----------------------------------------------------------------*/ 308 318 309 319 /* ··· 344 330 345 331 struct buffer_aux { 346 332 struct dm_block_validator *validator; 347 - struct block_lock lock; 348 333 int write_locked; 334 + 335 + #ifdef CONFIG_DM_DEBUG_BLOCK_MANAGER_LOCKING 336 + struct block_lock lock; 337 + #endif 349 338 }; 350 339 351 340 static void dm_block_manager_alloc_callback(struct dm_buffer *buf)