@@ -465,24 +465,27 @@ struct __pmem_dpt {
465465};
466466/////////////// Per-Page Logging ///////////////////
467467
468+ /*
469+ * The high-level struc of page-level logging
470+ * */
468471struct __pmem_page_part_log {
469472 PMEMrwlock lock ;
470473 /*log buffer area*/
471474
472- uint64_t size ; //the total size
473- PMEMoid data ; //pointer to allocated nvm
474- byte * p_align ; //align
475+ uint64_t size ; //the total size
476+ PMEMoid data ; //pointer to allocated nvm
477+ byte * p_align ; //align
475478
476- uint64_t log_buf_size ; //log block size in bytes
477- uint64_t n_log_bufs ;
478- TOID (PMEM_PAGE_LOG_FREE_POOL ) free_pool ;
479+ uint64_t log_buf_size ; //log block size in bytes
480+ uint64_t n_log_bufs ;
481+ TOID (PMEM_PAGE_LOG_FREE_POOL ) free_pool ;
479482
480483 // Transaction Table
481484 TOID (PMEM_TT ) tt ; // transaction table
482485
483486
484487 bool is_new ;
485- /*log data as hash table*/
488+ /*log area as hash table*/
486489 uint64_t n_buckets ; //# of buckets
487490 TOID_ARRAY (TOID (PMEM_PAGE_LOG_HASHED_LINE )) buckets ;
488491
@@ -497,32 +500,32 @@ struct __pmem_page_part_log {
497500 PMEM_LOG_FLUSHER * flusher ;
498501
499502 /*DRAM Log File*/
500- uint64_t log_file_size ;
501- pfs_os_file_t log_files [1000 ];
502- uint64_t n_log_files_per_bucket ;
503+ uint64_t log_file_size ;
504+ pfs_os_file_t log_files [4096 ];
505+ uint64_t n_log_files_per_bucket ;
503506 PMEM_LOG_GROUP * * log_groups ; //n_buckets groups
504507 fil_node_t * * node_arr ; // n_buckets fil_nodes
505508 fil_space_t * log_space ;
506509 /*Statistic info*/
507510 //log area
508- uint64_t pmem_alloc_size ;
511+ uint64_t pmem_alloc_size ;
509512
510513 //metadata
511- uint64_t pmem_page_log_size ;
512- uint64_t pmem_page_log_free_pool_size ;
513- uint64_t pmem_tt_size ;
514+ uint64_t pmem_page_log_size ;
515+ uint64_t pmem_page_log_free_pool_size ;
516+ uint64_t pmem_tt_size ;
514517
515518 /*Debug*/
516- FILE * deb_file ;
519+ FILE * deb_file ;
517520};
518521/*
519- * A hashed line has array of log blocks share the same hashed value
522+ * A hashed line has array of log blocks share the same hashed value and log buffer
520523 * */
521524struct __pmem_page_log_hashed_line {
522525 PMEMrwlock lock ;
523526
524527 int hashed_id ;
525- TOID (PMEM_PAGE_LOG_BUF ) logbuf ;
528+ TOID (PMEM_PAGE_LOG_BUF ) logbuf ; //pointer to log buffer
526529
527530 uint64_t diskaddr ; //log file offset, update when flush log, reset when purging file
528531 uint64_t write_diskaddr ; //diskaddr that log recs are durable write write_diskaddr < diskaddr
@@ -536,7 +539,14 @@ struct __pmem_page_log_hashed_line {
536539 TOID_ARRAY (TOID (PMEM_PAGE_LOG_BLOCK )) arr ;
537540 //TODO:
538541 // log file
542+ /*Statistic info*/
543+ #if defined(UNIV_PMEMOBJ_PPL_STAT )
544+ uint64_t log_write_lock_wait_time ; //total time lock holding for copying log records to log buffer
545+ uint64_t n_log_write ; //total copies
539546
547+ uint64_t log_flush_lock_wait_time ; //total time of lock holding for flushing log buffer to disk
548+ uint64_t n_log_flush ; //total
549+ #endif
540550};
541551
542552struct __pmem_page_log_free_pool {
@@ -621,19 +631,20 @@ pm_log_flusher_close(PMEM_LOG_FLUSHER* flusher);
621631
622632struct __pmem_tt_entry {
623633 PMEMrwlock lock ;
624- uint64_t eid ; //block id
625- uint64_t tid ; //transaction id
634+ uint64_t eid ; //block id
635+ uint64_t tid ; //transaction id
626636 PMEM_TX_STATE state ;
627-
628- TOID_ARRAY (TOID (PMEM_PAGE_REF )) dp_arr ; //dirty page array consists of key of entry in dirty page table
629- uint64_t n_dp_entries ;
637+
638+ /*dirty page array consists of (key, bid) pair of dirty pages caused by this transaction*/
639+ TOID_ARRAY (TOID (PMEM_PAGE_REF )) dp_arr ;
640+ uint64_t n_dp_entries ;
630641};
631642
632643struct __pmem_tt_hashed_line {
633644 PMEMrwlock lock ;
634645
635- uint64_t hashed_id ;
636- uint64_t n_entries ; //the total log block in bucket
646+ uint64_t hashed_id ;
647+ uint64_t n_entries ; //the total log block in bucket
637648 TOID_ARRAY (TOID (PMEM_TT_ENTRY )) arr ;
638649
639650};
@@ -753,15 +764,14 @@ pm_ptxl_check_and_reset_dpt_entry(
753764 PMEM_DPT * pdpt ,
754765 uint64_t key );
755766
756- //for debugging
757- void
758- __print_tx_blocks_state (FILE * f ,
759- PMEM_TX_PART_LOG * ptxl );
767+
768+ #if defined (UNIV_PMEMOBJ_PART_PL_STAT )
760769void
761770__print_page_blocks_state (FILE * f ,
762771 PMEM_PAGE_PART_LOG * ppl );
763-
764- #if defined (UNIV_PMEMOBJ_PART_PL_STAT )
772+ void
773+ __print_tx_blocks_state (FILE * f ,
774+ PMEM_TX_PART_LOG * ptxl );
765775void
766776ptxl_consolidate_stat_info (PMEM_TX_LOG_BLOCK * plog_block );
767777void
@@ -1009,7 +1019,13 @@ pm_log_fil_node_create(
10091019 fil_space_t * space );
10101020/////////////// END LOG FILES ///////////
10111021
1022+ //Statistic
1023+ #if defined(UNIV_PMEMOBJ_PPL_STAT )
1024+ void
1025+ __print_lock_overhead (FILE * f ,
1026+ PMEM_PAGE_PART_LOG * ppl );
10121027
1028+ #endif
10131029//for debugging
10141030void
10151031__print_blocks_state (FILE * f ,
0 commit comments