diff options
author | Tao Ma <boyu.mt@taobao.com> | 2011-02-23 09:10:56 -0500 |
---|---|---|
committer | Tao Ma <boyu.mt@taobao.com> | 2011-02-23 09:10:56 -0500 |
commit | 2661836e0ca07f57505563ec31aeee20b1758987 (patch) | |
tree | 4a21f3dfafc4178d9382b2236b04b19e92a741ec /fs/ocfs2 | |
parent | 402b418311f0d20a71451770d764a2e37b08dbcf (diff) |
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>
Diffstat (limited to 'fs/ocfs2')
-rw-r--r-- | fs/ocfs2/cluster/masklog.c | 1 | ||||
-rw-r--r-- | fs/ocfs2/cluster/masklog.h | 1 | ||||
-rw-r--r-- | fs/ocfs2/ocfs2_trace.h | 116 | ||||
-rw-r--r-- | fs/ocfs2/reservations.c | 57 |
4 files changed, 142 insertions, 33 deletions
diff --git a/fs/ocfs2/cluster/masklog.c b/fs/ocfs2/cluster/masklog.c index ef140ab7dcf8..39f2a46810d1 100644 --- a/fs/ocfs2/cluster/masklog.c +++ b/fs/ocfs2/cluster/masklog.c | |||
@@ -104,7 +104,6 @@ static struct mlog_attribute mlog_attrs[MLOG_MAX_BITS] = { | |||
104 | define_mask(EXPORT), | 104 | define_mask(EXPORT), |
105 | define_mask(QUOTA), | 105 | define_mask(QUOTA), |
106 | define_mask(BASTS), | 106 | define_mask(BASTS), |
107 | define_mask(RESERVATIONS), | ||
108 | define_mask(CLUSTER), | 107 | define_mask(CLUSTER), |
109 | define_mask(ERROR), | 108 | define_mask(ERROR), |
110 | define_mask(NOTICE), | 109 | define_mask(NOTICE), |
diff --git a/fs/ocfs2/cluster/masklog.h b/fs/ocfs2/cluster/masklog.h index f574b167e8dc..c36b4d8d5aa9 100644 --- a/fs/ocfs2/cluster/masklog.h +++ b/fs/ocfs2/cluster/masklog.h | |||
@@ -106,7 +106,6 @@ | |||
106 | #define ML_EXPORT 0x0000000010000000ULL /* ocfs2 export operations */ | 106 | #define ML_EXPORT 0x0000000010000000ULL /* ocfs2 export operations */ |
107 | #define ML_QUOTA 0x0000000040000000ULL /* ocfs2 quota operations */ | 107 | #define ML_QUOTA 0x0000000040000000ULL /* ocfs2 quota operations */ |
108 | #define ML_BASTS 0x0000000100000000ULL /* dlmglue asts and basts */ | 108 | #define ML_BASTS 0x0000000100000000ULL /* dlmglue asts and basts */ |
109 | #define ML_RESERVATIONS 0x0000000200000000ULL /* ocfs2 alloc reservations */ | ||
110 | #define ML_CLUSTER 0x0000000400000000ULL /* cluster stack */ | 109 | #define ML_CLUSTER 0x0000000400000000ULL /* cluster stack */ |
111 | 110 | ||
112 | /* bits that are infrequently given and frequently matched in the high word */ | 111 | /* bits that are infrequently given and frequently matched in the high word */ |
diff --git a/fs/ocfs2/ocfs2_trace.h b/fs/ocfs2/ocfs2_trace.h index 0fc2840d6fb1..1c040fcbd6e7 100644 --- a/fs/ocfs2/ocfs2_trace.h +++ b/fs/ocfs2/ocfs2_trace.h | |||
@@ -1809,6 +1809,122 @@ DEFINE_OCFS2_ULL_UINT_UINT_EVENT(ocfs2_reflink_xattr_buckets); | |||
1809 | DEFINE_OCFS2_ULL_UINT_EVENT(ocfs2_reflink_xattr_rec); | 1809 | DEFINE_OCFS2_ULL_UINT_EVENT(ocfs2_reflink_xattr_rec); |
1810 | 1810 | ||
1811 | /* End of trace events for fs/ocfs2/xattr.c. */ | 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 | #endif /* _TRACE_OCFS2_H */ | 1928 | #endif /* _TRACE_OCFS2_H */ |
1813 | 1929 | ||
1814 | /* This part must be outside protection */ | 1930 | /* This part must be outside protection */ |
diff --git a/fs/ocfs2/reservations.c b/fs/ocfs2/reservations.c index 3e78db361bc7..41ffd36c689c 100644 --- a/fs/ocfs2/reservations.c +++ b/fs/ocfs2/reservations.c | |||
@@ -30,10 +30,10 @@ | |||
30 | #include <linux/bitops.h> | 30 | #include <linux/bitops.h> |
31 | #include <linux/list.h> | 31 | #include <linux/list.h> |
32 | 32 | ||
33 | #define MLOG_MASK_PREFIX ML_RESERVATIONS | ||
34 | #include <cluster/masklog.h> | 33 | #include <cluster/masklog.h> |
35 | 34 | ||
36 | #include "ocfs2.h" | 35 | #include "ocfs2.h" |
36 | #include "ocfs2_trace.h" | ||
37 | 37 | ||
38 | #ifdef CONFIG_OCFS2_DEBUG_FS | 38 | #ifdef CONFIG_OCFS2_DEBUG_FS |
39 | #define OCFS2_CHECK_RESERVATIONS | 39 | #define OCFS2_CHECK_RESERVATIONS |
@@ -321,8 +321,7 @@ static void ocfs2_resv_insert(struct ocfs2_reservation_map *resmap, | |||
321 | 321 | ||
322 | assert_spin_locked(&resv_lock); | 322 | assert_spin_locked(&resv_lock); |
323 | 323 | ||
324 | mlog(0, "Insert reservation start: %u len: %u\n", new->r_start, | 324 | trace_ocfs2_resv_insert(new->r_start, new->r_len); |
325 | new->r_len); | ||
326 | 325 | ||
327 | while (*p) { | 326 | while (*p) { |
328 | parent = *p; | 327 | parent = *p; |
@@ -423,8 +422,8 @@ static int ocfs2_resmap_find_free_bits(struct ocfs2_reservation_map *resmap, | |||
423 | unsigned int best_start, best_len = 0; | 422 | unsigned int best_start, best_len = 0; |
424 | int offset, start, found; | 423 | int offset, start, found; |
425 | 424 | ||
426 | mlog(0, "Find %u bits within range (%u, len %u) resmap len: %u\n", | 425 | trace_ocfs2_resmap_find_free_bits_begin(search_start, search_len, |
427 | wanted, search_start, search_len, resmap->m_bitmap_len); | 426 | wanted, resmap->m_bitmap_len); |
428 | 427 | ||
429 | found = best_start = best_len = 0; | 428 | found = best_start = best_len = 0; |
430 | 429 | ||
@@ -463,7 +462,7 @@ static int ocfs2_resmap_find_free_bits(struct ocfs2_reservation_map *resmap, | |||
463 | *rlen = best_len; | 462 | *rlen = best_len; |
464 | *rstart = best_start; | 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 | return *rlen; | 467 | return *rlen; |
469 | } | 468 | } |
@@ -487,9 +486,8 @@ static void __ocfs2_resv_find_window(struct ocfs2_reservation_map *resmap, | |||
487 | * - our window should be last in all reservations | 486 | * - our window should be last in all reservations |
488 | * - need to make sure we don't go past end of bitmap | 487 | * - need to make sure we don't go past end of bitmap |
489 | */ | 488 | */ |
490 | 489 | trace_ocfs2_resv_find_window_begin(resv->r_start, ocfs2_resv_end(resv), | |
491 | mlog(0, "resv start: %u resv end: %u goal: %u wanted: %u\n", | 490 | goal, wanted, RB_EMPTY_ROOT(root)); |
492 | resv->r_start, ocfs2_resv_end(resv), goal, wanted); | ||
493 | 491 | ||
494 | assert_spin_locked(&resv_lock); | 492 | assert_spin_locked(&resv_lock); |
495 | 493 | ||
@@ -498,9 +496,6 @@ static void __ocfs2_resv_find_window(struct ocfs2_reservation_map *resmap, | |||
498 | * Easiest case - empty tree. We can just take | 496 | * Easiest case - empty tree. We can just take |
499 | * whatever window of free bits we want. | 497 | * whatever window of free bits we want. |
500 | */ | 498 | */ |
501 | |||
502 | mlog(0, "Empty root\n"); | ||
503 | |||
504 | clen = ocfs2_resmap_find_free_bits(resmap, wanted, goal, | 499 | clen = ocfs2_resmap_find_free_bits(resmap, wanted, goal, |
505 | resmap->m_bitmap_len - goal, | 500 | resmap->m_bitmap_len - goal, |
506 | &cstart, &clen); | 501 | &cstart, &clen); |
@@ -524,8 +519,6 @@ static void __ocfs2_resv_find_window(struct ocfs2_reservation_map *resmap, | |||
524 | prev_resv = ocfs2_find_resv_lhs(resmap, goal); | 519 | prev_resv = ocfs2_find_resv_lhs(resmap, goal); |
525 | 520 | ||
526 | if (prev_resv == NULL) { | 521 | if (prev_resv == NULL) { |
527 | mlog(0, "Goal on LHS of leftmost window\n"); | ||
528 | |||
529 | /* | 522 | /* |
530 | * A NULL here means that the search code couldn't | 523 | * A NULL here means that the search code couldn't |
531 | * find a window that starts before goal. | 524 | * find a window that starts before goal. |
@@ -570,13 +563,15 @@ static void __ocfs2_resv_find_window(struct ocfs2_reservation_map *resmap, | |||
570 | next_resv = NULL; | 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 | prev = &prev_resv->r_node; | 569 | prev = &prev_resv->r_node; |
574 | 570 | ||
575 | /* Now we do a linear search for a window, starting at 'prev_rsv' */ | 571 | /* Now we do a linear search for a window, starting at 'prev_rsv' */ |
576 | while (1) { | 572 | while (1) { |
577 | next = rb_next(prev); | 573 | next = rb_next(prev); |
578 | if (next) { | 574 | if (next) { |
579 | mlog(0, "One more resv found in linear search\n"); | ||
580 | next_resv = rb_entry(next, | 575 | next_resv = rb_entry(next, |
581 | struct ocfs2_alloc_reservation, | 576 | struct ocfs2_alloc_reservation, |
582 | r_node); | 577 | r_node); |
@@ -585,7 +580,6 @@ static void __ocfs2_resv_find_window(struct ocfs2_reservation_map *resmap, | |||
585 | gap_end = next_resv->r_start - 1; | 580 | gap_end = next_resv->r_start - 1; |
586 | gap_len = gap_end - gap_start + 1; | 581 | gap_len = gap_end - gap_start + 1; |
587 | } else { | 582 | } else { |
588 | mlog(0, "No next node\n"); | ||
589 | /* | 583 | /* |
590 | * We're at the rightmost edge of the | 584 | * We're at the rightmost edge of the |
591 | * tree. See if a reservation between this | 585 | * tree. See if a reservation between this |
@@ -596,6 +590,8 @@ static void __ocfs2_resv_find_window(struct ocfs2_reservation_map *resmap, | |||
596 | gap_end = resmap->m_bitmap_len - 1; | 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 | * No need to check this gap if we have already found | 596 | * No need to check this gap if we have already found |
601 | * a larger region of free bits. | 597 | * a larger region of free bits. |
@@ -654,8 +650,9 @@ static void ocfs2_cannibalize_resv(struct ocfs2_reservation_map *resmap, | |||
654 | lru_resv = list_first_entry(&resmap->m_lru, | 650 | lru_resv = list_first_entry(&resmap->m_lru, |
655 | struct ocfs2_alloc_reservation, r_lru); | 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, | 653 | trace_ocfs2_cannibalize_resv_begin(lru_resv->r_start, |
658 | lru_resv->r_len, ocfs2_resv_end(lru_resv)); | 654 | lru_resv->r_len, |
655 | ocfs2_resv_end(lru_resv)); | ||
659 | 656 | ||
660 | /* | 657 | /* |
661 | * Cannibalize (some or all) of the target reservation and | 658 | * Cannibalize (some or all) of the target reservation and |
@@ -684,10 +681,9 @@ static void ocfs2_cannibalize_resv(struct ocfs2_reservation_map *resmap, | |||
684 | resv->r_len = shrink; | 681 | resv->r_len = shrink; |
685 | } | 682 | } |
686 | 683 | ||
687 | mlog(0, "Reservation now looks like: r_start: %u r_end: %u " | 684 | trace_ocfs2_cannibalize_resv_end(resv->r_start, ocfs2_resv_end(resv), |
688 | "r_len: %u r_last_start: %u r_last_len: %u\n", | 685 | resv->r_len, resv->r_last_start, |
689 | resv->r_start, ocfs2_resv_end(resv), resv->r_len, | 686 | resv->r_last_len); |
690 | resv->r_last_start, resv->r_last_len); | ||
691 | 687 | ||
692 | ocfs2_resv_insert(resmap, resv); | 688 | ocfs2_resv_insert(resmap, resv); |
693 | } | 689 | } |
@@ -748,7 +744,6 @@ int ocfs2_resmap_resv_bits(struct ocfs2_reservation_map *resmap, | |||
748 | if ((resv->r_flags & OCFS2_RESV_FLAG_TMP) || wanted < *clen) | 744 | if ((resv->r_flags & OCFS2_RESV_FLAG_TMP) || wanted < *clen) |
749 | wanted = *clen; | 745 | wanted = *clen; |
750 | 746 | ||
751 | mlog(0, "empty reservation, find new window\n"); | ||
752 | /* | 747 | /* |
753 | * Try to get a window here. If it works, we must fall | 748 | * Try to get a window here. If it works, we must fall |
754 | * through and test the bitmap . This avoids some | 749 | * through and test the bitmap . This avoids some |
@@ -757,6 +752,7 @@ int ocfs2_resmap_resv_bits(struct ocfs2_reservation_map *resmap, | |||
757 | * that inode. | 752 | * that inode. |
758 | */ | 753 | */ |
759 | ocfs2_resv_find_window(resmap, resv, wanted); | 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 | BUG_ON(ocfs2_resv_empty(resv)); | 758 | BUG_ON(ocfs2_resv_empty(resv)); |
@@ -813,10 +809,10 @@ void ocfs2_resmap_claimed_bits(struct ocfs2_reservation_map *resmap, | |||
813 | 809 | ||
814 | spin_lock(&resv_lock); | 810 | spin_lock(&resv_lock); |
815 | 811 | ||
816 | mlog(0, "claim bits: cstart: %u cend: %u clen: %u r_start: %u " | 812 | trace_ocfs2_resmap_claimed_bits_begin(cstart, cend, clen, resv->r_start, |
817 | "r_end: %u r_len: %u, r_last_start: %u r_last_len: %u\n", | 813 | ocfs2_resv_end(resv), resv->r_len, |
818 | cstart, cend, clen, resv->r_start, ocfs2_resv_end(resv), | 814 | resv->r_last_start, |
819 | resv->r_len, resv->r_last_start, resv->r_last_len); | 815 | resv->r_last_len); |
820 | 816 | ||
821 | BUG_ON(cstart < resv->r_start); | 817 | BUG_ON(cstart < resv->r_start); |
822 | BUG_ON(cstart > ocfs2_resv_end(resv)); | 818 | BUG_ON(cstart > ocfs2_resv_end(resv)); |
@@ -833,10 +829,9 @@ void ocfs2_resmap_claimed_bits(struct ocfs2_reservation_map *resmap, | |||
833 | if (!ocfs2_resv_empty(resv)) | 829 | if (!ocfs2_resv_empty(resv)) |
834 | ocfs2_resv_mark_lru(resmap, resv); | 830 | ocfs2_resv_mark_lru(resmap, resv); |
835 | 831 | ||
836 | mlog(0, "Reservation now looks like: r_start: %u r_end: %u " | 832 | trace_ocfs2_resmap_claimed_bits_end(resv->r_start, ocfs2_resv_end(resv), |
837 | "r_len: %u r_last_start: %u r_last_len: %u\n", | 833 | resv->r_len, resv->r_last_start, |
838 | resv->r_start, ocfs2_resv_end(resv), resv->r_len, | 834 | resv->r_last_len); |
839 | resv->r_last_start, resv->r_last_len); | ||
840 | 835 | ||
841 | ocfs2_check_resmap(resmap); | 836 | ocfs2_check_resmap(resmap); |
842 | 837 | ||