MCPcopy Create free account
hub / github.com/ceph/ceph / _enqueue

Method _enqueue

src/mds/ScrubStack.cc:72–118  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

70}
71
72int ScrubStack::_enqueue(MDSCacheObject *obj, ScrubHeaderRef& header, bool top)
73{
74 ceph_assert(ceph_mutex_is_locked_by_me(mdcache->mds->mds_lock));
75 if (CInode *in = dynamic_cast<CInode*>(obj)) {
76 if (in->scrub_is_in_progress()) {
77 dout(10) << __func__ << " with {" << *in << "}" << ", already in scrubbing" << dendl;
78 return -EBUSY;
79 }
80 if(in->state_test(CInode::STATE_PURGING)) {
81 dout(10) << *obj << " is purging, skip pushing into scrub stack" << dendl;
82 // treating this as success since purge will make sure this inode goes away
83 return 0;
84 }
85
86 dout(10) << __func__ << " with {" << *in << "}" << ", top=" << top << dendl;
87 in->scrub_initialize(header);
88 in->uninline_initialize();
89 } else if (CDir *dir = dynamic_cast<CDir*>(obj)) {
90 if (dir->scrub_is_in_progress()) {
91 dout(10) << __func__ << " with {" << *dir << "}" << ", already in scrubbing" << dendl;
92 return -EBUSY;
93 }
94 if(dir->get_inode()->state_test(CInode::STATE_PURGING)) {
95 dout(10) << *obj << " is purging, skip pushing into scrub stack" << dendl;
96 // treating this as success since purge will make sure this dir inode goes away
97 return 0;
98 }
99
100 dout(10) << __func__ << " with {" << *dir << "}" << ", top=" << top << dendl;
101 // The edge directory must be in memory
102 dir->auth_pin(this);
103 dir->scrub_initialize(header);
104 } else {
105 ceph_assert(0 == "queue dentry to scrub stack");
106 }
107
108 dout(20) << "enqueue " << *obj << " to " << (top ? "top" : "bottom") << " of ScrubStack" << dendl;
109 if (!obj->item_scrub.is_on_list()) {
110 obj->get(MDSCacheObject::PIN_SCRUBQUEUE);
111 stack_size++;
112 }
113 if (top)
114 scrub_stack.push_front(&obj->item_scrub);
115 else
116 scrub_stack.push_back(&obj->item_scrub);
117 return 0;
118}
119
120void ScrubStack::purge_scrub_counters(std::string_view tag)
121{

Callers

nothing calls this directly

Calls 10

uninline_initializeMethod · 0.80
scrub_is_in_progressMethod · 0.45
state_testMethod · 0.45
scrub_initializeMethod · 0.45
get_inodeMethod · 0.45
auth_pinMethod · 0.45
is_on_listMethod · 0.45
getMethod · 0.45
push_frontMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected