Commit 2661836e0ca07f57505563ec31aeee20b1758987
1 parent
402b418311
Exists in
master
and in
7 other branches
ocfs2: Remove masklog ML_RESERVATIONS.
Remove mlog(0) from fs/ocfs2/reservations.c and the masklog RESERVATIONS. Signed-off-by: Tao Ma <boyu.mt@taobao.com>
Showing 4 changed files with 142 additions and 33 deletions Side-by-side Diff
fs/ocfs2/cluster/masklog.c
fs/ocfs2/cluster/masklog.h
... | ... | @@ -106,7 +106,6 @@ |
106 | 106 | #define ML_EXPORT 0x0000000010000000ULL /* ocfs2 export operations */ |
107 | 107 | #define ML_QUOTA 0x0000000040000000ULL /* ocfs2 quota operations */ |
108 | 108 | #define ML_BASTS 0x0000000100000000ULL /* dlmglue asts and basts */ |
109 | -#define ML_RESERVATIONS 0x0000000200000000ULL /* ocfs2 alloc reservations */ | |
110 | 109 | #define ML_CLUSTER 0x0000000400000000ULL /* cluster stack */ |
111 | 110 | |
112 | 111 | /* bits that are infrequently given and frequently matched in the high word */ |
fs/ocfs2/ocfs2_trace.h
... | ... | @@ -1809,6 +1809,122 @@ |
1809 | 1809 | DEFINE_OCFS2_ULL_UINT_EVENT(ocfs2_reflink_xattr_rec); |
1810 | 1810 | |
1811 | 1811 | /* End of trace events for fs/ocfs2/xattr.c. */ |
1812 | + | |
1813 | +/* Trace events for fs/ocfs2/reservations.c. */ | |
1814 | + | |
1815 | +DEFINE_OCFS2_UINT_UINT_EVENT(ocfs2_resv_insert); | |
1816 | + | |
1817 | +DEFINE_OCFS2_ULL_UINT_UINT_UINT_EVENT(ocfs2_resmap_find_free_bits_begin); | |
1818 | + | |
1819 | +DEFINE_OCFS2_UINT_UINT_EVENT(ocfs2_resmap_find_free_bits_end); | |
1820 | + | |
1821 | +TRACE_EVENT(ocfs2_resv_find_window_begin, | |
1822 | + TP_PROTO(unsigned int r_start, unsigned int r_end, unsigned int goal, | |
1823 | + unsigned int wanted, int empty_root), | |
1824 | + TP_ARGS(r_start, r_end, goal, wanted, empty_root), | |
1825 | + TP_STRUCT__entry( | |
1826 | + __field(unsigned int, r_start) | |
1827 | + __field(unsigned int, r_end) | |
1828 | + __field(unsigned int, goal) | |
1829 | + __field(unsigned int, wanted) | |
1830 | + __field(int, empty_root) | |
1831 | + ), | |
1832 | + TP_fast_assign( | |
1833 | + __entry->r_start = r_start; | |
1834 | + __entry->r_end = r_end; | |
1835 | + __entry->goal = goal; | |
1836 | + __entry->wanted = wanted; | |
1837 | + __entry->empty_root = empty_root; | |
1838 | + ), | |
1839 | + TP_printk("%u %u %u %u %d", __entry->r_start, __entry->r_end, | |
1840 | + __entry->goal, __entry->wanted, __entry->empty_root) | |
1841 | +); | |
1842 | + | |
1843 | +DEFINE_OCFS2_UINT_UINT_EVENT(ocfs2_resv_find_window_prev); | |
1844 | + | |
1845 | +DEFINE_OCFS2_INT_INT_EVENT(ocfs2_resv_find_window_next); | |
1846 | + | |
1847 | +DEFINE_OCFS2_UINT_UINT_UINT_EVENT(ocfs2_cannibalize_resv_begin); | |
1848 | + | |
1849 | +TRACE_EVENT(ocfs2_cannibalize_resv_end, | |
1850 | + TP_PROTO(unsigned int start, unsigned int end, unsigned int len, | |
1851 | + unsigned int last_start, unsigned int last_len), | |
1852 | + TP_ARGS(start, end, len, last_start, last_len), | |
1853 | + TP_STRUCT__entry( | |
1854 | + __field(unsigned int, start) | |
1855 | + __field(unsigned int, end) | |
1856 | + __field(unsigned int, len) | |
1857 | + __field(unsigned int, last_start) | |
1858 | + __field(unsigned int, last_len) | |
1859 | + ), | |
1860 | + TP_fast_assign( | |
1861 | + __entry->start = start; | |
1862 | + __entry->end = end; | |
1863 | + __entry->len = len; | |
1864 | + __entry->last_start = last_start; | |
1865 | + __entry->last_len = last_len; | |
1866 | + ), | |
1867 | + TP_printk("%u %u %u %u %u", __entry->start, __entry->end, | |
1868 | + __entry->len, __entry->last_start, __entry->last_len) | |
1869 | +); | |
1870 | + | |
1871 | +DEFINE_OCFS2_UINT_UINT_EVENT(ocfs2_resmap_resv_bits); | |
1872 | + | |
1873 | +TRACE_EVENT(ocfs2_resmap_claimed_bits_begin, | |
1874 | + TP_PROTO(unsigned int cstart, unsigned int cend, unsigned int clen, | |
1875 | + unsigned int r_start, unsigned int r_end, unsigned int r_len, | |
1876 | + unsigned int last_start, unsigned int last_len), | |
1877 | + TP_ARGS(cstart, cend, clen, r_start, r_end, | |
1878 | + r_len, last_start, last_len), | |
1879 | + TP_STRUCT__entry( | |
1880 | + __field(unsigned int, cstart) | |
1881 | + __field(unsigned int, cend) | |
1882 | + __field(unsigned int, clen) | |
1883 | + __field(unsigned int, r_start) | |
1884 | + __field(unsigned int, r_end) | |
1885 | + __field(unsigned int, r_len) | |
1886 | + __field(unsigned int, last_start) | |
1887 | + __field(unsigned int, last_len) | |
1888 | + ), | |
1889 | + TP_fast_assign( | |
1890 | + __entry->cstart = cstart; | |
1891 | + __entry->cend = cend; | |
1892 | + __entry->clen = clen; | |
1893 | + __entry->r_start = r_start; | |
1894 | + __entry->r_end = r_end; | |
1895 | + __entry->r_len = r_len; | |
1896 | + __entry->last_start = last_start; | |
1897 | + __entry->last_len = last_len; | |
1898 | + ), | |
1899 | + TP_printk("%u %u %u %u %u %u %u %u", | |
1900 | + __entry->cstart, __entry->cend, __entry->clen, | |
1901 | + __entry->r_start, __entry->r_end, __entry->r_len, | |
1902 | + __entry->last_start, __entry->last_len) | |
1903 | +); | |
1904 | + | |
1905 | +TRACE_EVENT(ocfs2_resmap_claimed_bits_end, | |
1906 | + TP_PROTO(unsigned int start, unsigned int end, unsigned int len, | |
1907 | + unsigned int last_start, unsigned int last_len), | |
1908 | + TP_ARGS(start, end, len, last_start, last_len), | |
1909 | + TP_STRUCT__entry( | |
1910 | + __field(unsigned int, start) | |
1911 | + __field(unsigned int, end) | |
1912 | + __field(unsigned int, len) | |
1913 | + __field(unsigned int, last_start) | |
1914 | + __field(unsigned int, last_len) | |
1915 | + ), | |
1916 | + TP_fast_assign( | |
1917 | + __entry->start = start; | |
1918 | + __entry->end = end; | |
1919 | + __entry->len = len; | |
1920 | + __entry->last_start = last_start; | |
1921 | + __entry->last_len = last_len; | |
1922 | + ), | |
1923 | + TP_printk("%u %u %u %u %u", __entry->start, __entry->end, | |
1924 | + __entry->len, __entry->last_start, __entry->last_len) | |
1925 | +); | |
1926 | + | |
1927 | +/* End of trace events for fs/ocfs2/reservations.c. */ | |
1812 | 1928 | #endif /* _TRACE_OCFS2_H */ |
1813 | 1929 | |
1814 | 1930 | /* This part must be outside protection */ |
fs/ocfs2/reservations.c
... | ... | @@ -30,10 +30,10 @@ |
30 | 30 | #include <linux/bitops.h> |
31 | 31 | #include <linux/list.h> |
32 | 32 | |
33 | -#define MLOG_MASK_PREFIX ML_RESERVATIONS | |
34 | 33 | #include <cluster/masklog.h> |
35 | 34 | |
36 | 35 | #include "ocfs2.h" |
36 | +#include "ocfs2_trace.h" | |
37 | 37 | |
38 | 38 | #ifdef CONFIG_OCFS2_DEBUG_FS |
39 | 39 | #define OCFS2_CHECK_RESERVATIONS |
... | ... | @@ -321,8 +321,7 @@ |
321 | 321 | |
322 | 322 | assert_spin_locked(&resv_lock); |
323 | 323 | |
324 | - mlog(0, "Insert reservation start: %u len: %u\n", new->r_start, | |
325 | - new->r_len); | |
324 | + trace_ocfs2_resv_insert(new->r_start, new->r_len); | |
326 | 325 | |
327 | 326 | while (*p) { |
328 | 327 | parent = *p; |
... | ... | @@ -423,8 +422,8 @@ |
423 | 422 | unsigned int best_start, best_len = 0; |
424 | 423 | int offset, start, found; |
425 | 424 | |
426 | - mlog(0, "Find %u bits within range (%u, len %u) resmap len: %u\n", | |
427 | - wanted, search_start, search_len, resmap->m_bitmap_len); | |
425 | + trace_ocfs2_resmap_find_free_bits_begin(search_start, search_len, | |
426 | + wanted, resmap->m_bitmap_len); | |
428 | 427 | |
429 | 428 | found = best_start = best_len = 0; |
430 | 429 | |
... | ... | @@ -463,7 +462,7 @@ |
463 | 462 | *rlen = best_len; |
464 | 463 | *rstart = best_start; |
465 | 464 | |
466 | - mlog(0, "Found start: %u len: %u\n", best_start, best_len); | |
465 | + trace_ocfs2_resmap_find_free_bits_end(best_start, best_len); | |
467 | 466 | |
468 | 467 | return *rlen; |
469 | 468 | } |
470 | 469 | |
... | ... | @@ -487,10 +486,9 @@ |
487 | 486 | * - our window should be last in all reservations |
488 | 487 | * - need to make sure we don't go past end of bitmap |
489 | 488 | */ |
489 | + trace_ocfs2_resv_find_window_begin(resv->r_start, ocfs2_resv_end(resv), | |
490 | + goal, wanted, RB_EMPTY_ROOT(root)); | |
490 | 491 | |
491 | - mlog(0, "resv start: %u resv end: %u goal: %u wanted: %u\n", | |
492 | - resv->r_start, ocfs2_resv_end(resv), goal, wanted); | |
493 | - | |
494 | 492 | assert_spin_locked(&resv_lock); |
495 | 493 | |
496 | 494 | if (RB_EMPTY_ROOT(root)) { |
... | ... | @@ -498,9 +496,6 @@ |
498 | 496 | * Easiest case - empty tree. We can just take |
499 | 497 | * whatever window of free bits we want. |
500 | 498 | */ |
501 | - | |
502 | - mlog(0, "Empty root\n"); | |
503 | - | |
504 | 499 | clen = ocfs2_resmap_find_free_bits(resmap, wanted, goal, |
505 | 500 | resmap->m_bitmap_len - goal, |
506 | 501 | &cstart, &clen); |
... | ... | @@ -524,8 +519,6 @@ |
524 | 519 | prev_resv = ocfs2_find_resv_lhs(resmap, goal); |
525 | 520 | |
526 | 521 | if (prev_resv == NULL) { |
527 | - mlog(0, "Goal on LHS of leftmost window\n"); | |
528 | - | |
529 | 522 | /* |
530 | 523 | * A NULL here means that the search code couldn't |
531 | 524 | * find a window that starts before goal. |
532 | 525 | |
... | ... | @@ -570,13 +563,15 @@ |
570 | 563 | next_resv = NULL; |
571 | 564 | } |
572 | 565 | |
566 | + trace_ocfs2_resv_find_window_prev(prev_resv->r_start, | |
567 | + ocfs2_resv_end(prev_resv)); | |
568 | + | |
573 | 569 | prev = &prev_resv->r_node; |
574 | 570 | |
575 | 571 | /* Now we do a linear search for a window, starting at 'prev_rsv' */ |
576 | 572 | while (1) { |
577 | 573 | next = rb_next(prev); |
578 | 574 | if (next) { |
579 | - mlog(0, "One more resv found in linear search\n"); | |
580 | 575 | next_resv = rb_entry(next, |
581 | 576 | struct ocfs2_alloc_reservation, |
582 | 577 | r_node); |
... | ... | @@ -585,7 +580,6 @@ |
585 | 580 | gap_end = next_resv->r_start - 1; |
586 | 581 | gap_len = gap_end - gap_start + 1; |
587 | 582 | } else { |
588 | - mlog(0, "No next node\n"); | |
589 | 583 | /* |
590 | 584 | * We're at the rightmost edge of the |
591 | 585 | * tree. See if a reservation between this |
... | ... | @@ -596,6 +590,8 @@ |
596 | 590 | gap_end = resmap->m_bitmap_len - 1; |
597 | 591 | } |
598 | 592 | |
593 | + trace_ocfs2_resv_find_window_next(next ? next_resv->r_start: -1, | |
594 | + next ? ocfs2_resv_end(next_resv) : -1); | |
599 | 595 | /* |
600 | 596 | * No need to check this gap if we have already found |
601 | 597 | * a larger region of free bits. |
... | ... | @@ -654,8 +650,9 @@ |
654 | 650 | lru_resv = list_first_entry(&resmap->m_lru, |
655 | 651 | struct ocfs2_alloc_reservation, r_lru); |
656 | 652 | |
657 | - mlog(0, "lru resv: start: %u len: %u end: %u\n", lru_resv->r_start, | |
658 | - lru_resv->r_len, ocfs2_resv_end(lru_resv)); | |
653 | + trace_ocfs2_cannibalize_resv_begin(lru_resv->r_start, | |
654 | + lru_resv->r_len, | |
655 | + ocfs2_resv_end(lru_resv)); | |
659 | 656 | |
660 | 657 | /* |
661 | 658 | * Cannibalize (some or all) of the target reservation and |
... | ... | @@ -684,10 +681,9 @@ |
684 | 681 | resv->r_len = shrink; |
685 | 682 | } |
686 | 683 | |
687 | - mlog(0, "Reservation now looks like: r_start: %u r_end: %u " | |
688 | - "r_len: %u r_last_start: %u r_last_len: %u\n", | |
689 | - resv->r_start, ocfs2_resv_end(resv), resv->r_len, | |
690 | - resv->r_last_start, resv->r_last_len); | |
684 | + trace_ocfs2_cannibalize_resv_end(resv->r_start, ocfs2_resv_end(resv), | |
685 | + resv->r_len, resv->r_last_start, | |
686 | + resv->r_last_len); | |
691 | 687 | |
692 | 688 | ocfs2_resv_insert(resmap, resv); |
693 | 689 | } |
... | ... | @@ -748,7 +744,6 @@ |
748 | 744 | if ((resv->r_flags & OCFS2_RESV_FLAG_TMP) || wanted < *clen) |
749 | 745 | wanted = *clen; |
750 | 746 | |
751 | - mlog(0, "empty reservation, find new window\n"); | |
752 | 747 | /* |
753 | 748 | * Try to get a window here. If it works, we must fall |
754 | 749 | * through and test the bitmap . This avoids some |
... | ... | @@ -757,6 +752,7 @@ |
757 | 752 | * that inode. |
758 | 753 | */ |
759 | 754 | ocfs2_resv_find_window(resmap, resv, wanted); |
755 | + trace_ocfs2_resmap_resv_bits(resv->r_start, resv->r_len); | |
760 | 756 | } |
761 | 757 | |
762 | 758 | BUG_ON(ocfs2_resv_empty(resv)); |
... | ... | @@ -813,10 +809,10 @@ |
813 | 809 | |
814 | 810 | spin_lock(&resv_lock); |
815 | 811 | |
816 | - mlog(0, "claim bits: cstart: %u cend: %u clen: %u r_start: %u " | |
817 | - "r_end: %u r_len: %u, r_last_start: %u r_last_len: %u\n", | |
818 | - cstart, cend, clen, resv->r_start, ocfs2_resv_end(resv), | |
819 | - resv->r_len, resv->r_last_start, resv->r_last_len); | |
812 | + trace_ocfs2_resmap_claimed_bits_begin(cstart, cend, clen, resv->r_start, | |
813 | + ocfs2_resv_end(resv), resv->r_len, | |
814 | + resv->r_last_start, | |
815 | + resv->r_last_len); | |
820 | 816 | |
821 | 817 | BUG_ON(cstart < resv->r_start); |
822 | 818 | BUG_ON(cstart > ocfs2_resv_end(resv)); |
... | ... | @@ -833,10 +829,9 @@ |
833 | 829 | if (!ocfs2_resv_empty(resv)) |
834 | 830 | ocfs2_resv_mark_lru(resmap, resv); |
835 | 831 | |
836 | - mlog(0, "Reservation now looks like: r_start: %u r_end: %u " | |
837 | - "r_len: %u r_last_start: %u r_last_len: %u\n", | |
838 | - resv->r_start, ocfs2_resv_end(resv), resv->r_len, | |
839 | - resv->r_last_start, resv->r_last_len); | |
832 | + trace_ocfs2_resmap_claimed_bits_end(resv->r_start, ocfs2_resv_end(resv), | |
833 | + resv->r_len, resv->r_last_start, | |
834 | + resv->r_last_len); | |
840 | 835 | |
841 | 836 | ocfs2_check_resmap(resmap); |
842 | 837 |