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

jbd2: add COW fields to struct jbd2_journal_handle

Add fields needed for the copy-on-write ext4 development work.

The h_cowing flag is used by ext4 snapshots code to mark the task in
COWING state.

The h_XXX_credits fields are used to track buffer credits usage
(accounted by COW and non-COW operations).

The h_cow_XXX fields are used as per task debugging counters.

Merging this commit into mainline will allow users to test ext4
snapshots as a standalone module, without the need to patch and
install a development kernel.

Signed-off-by: Amir Goldstein <amir73il@users.sf.net>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>

authored by

Amir Goldstein and committed by
Theodore Ts'o
93737456 c2cc7028

+25 -3
+25 -3
include/linux/jbd2.h
··· 432 432 int h_err; 433 433 434 434 /* Flags [no locking] */ 435 - unsigned int h_sync: 1; /* sync-on-close */ 436 - unsigned int h_jdata: 1; /* force data journaling */ 437 - unsigned int h_aborted: 1; /* fatal error on handle */ 435 + unsigned int h_sync:1; /* sync-on-close */ 436 + unsigned int h_jdata:1; /* force data journaling */ 437 + unsigned int h_aborted:1; /* fatal error on handle */ 438 + unsigned int h_cowing:1; /* COWing block to snapshot */ 439 + 440 + /* Number of buffers requested by user: 441 + * (before adding the COW credits factor) */ 442 + unsigned int h_base_credits:14; 443 + 444 + /* Number of buffers the user is allowed to dirty: 445 + * (counts only buffers dirtied when !h_cowing) */ 446 + unsigned int h_user_credits:14; 447 + 438 448 439 449 #ifdef CONFIG_DEBUG_LOCK_ALLOC 440 450 struct lockdep_map h_lockdep_map; 451 + #endif 452 + 453 + #ifdef CONFIG_JBD2_DEBUG 454 + /* COW debugging counters: */ 455 + unsigned int h_cow_moved; /* blocks moved to snapshot */ 456 + unsigned int h_cow_copied; /* blocks copied to snapshot */ 457 + unsigned int h_cow_ok_jh; /* blocks already COWed during current 458 + transaction */ 459 + unsigned int h_cow_ok_bitmap; /* blocks not set in COW bitmap */ 460 + unsigned int h_cow_ok_mapped;/* blocks already mapped in snapshot */ 461 + unsigned int h_cow_bitmaps; /* COW bitmaps created */ 462 + unsigned int h_cow_excluded; /* blocks set in exclude bitmap */ 441 463 #endif 442 464 }; 443 465