What is the use of the ScrubStack class
Editor to share with you what is the use of the ScrubStack class, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to understand it!
The ScrubStack class is used to temporarily save the file or directory to be Scrub. For the directory, the dir- > scrub_initialize () function is finally called to perform the actual scrub operation; for the file, the inode- > validate_disk_state () function is called to perform the actual scrub operation.
The ScrubStack class description:
Class ScrubStack {
Finisher * finisher; finisher is used to handle callback processing after the completion of Scrub
Elist inode_stack; waits for Scrub's Inode stack
Int scrubs_in_progress; is currently in the number of scrub
Int stack_size; records the size of the stack
MDCache * mdcache; MDS Cache pointer
C_KickOffScrubs scrub_kick; launches the class object of scrub
}
ScrubStack class methods:
ScrubStack::push_inode (in)
| | _ _ check whether the item_scrub of in is not on the inode_stack list, that is, in- > item_scrub.is_on_list () |
| | _ _ sets the PIN_SCRUBQUEUE of in |
| | _ _ increment stack_size |
| | _ _ insert the item_scrub of in into the header of inode_stack array |
ScrubStack::push_inode_bottom (in)
| | _ _ check whether the item_scrub of in is not on the inode_stack list, that is, in- > item_scrub.is_on_list () |
| | _ _ sets the PIN_SCRUBQUEUE of in |
| | _ _ increment stack_size |
| | _ _ insert the item_scrub of in into the end of inode_stack array |
ScrubStack::pop_inode (in)
| | _ _ clear the PIN_SCRUBQUEUE of in |
| | _ _ delete the item_scrub of in from the inode_stack array |
| | _ _ decreasing stack_size |
ScrubStack::_enqueue_inode (in, parent, header, on_finish, top)
| | _ _ perform scrub initialization for in, that is, in- > scrub_initialize (parent, header, on_finish) |
| | _ top==true |
| | _ _ call push_inode (in) to insert in into the header of inode_stack |
| | _ top==false |
| | _ _ call push_inode_bottom (in) to insert in into the tail of inode_stack |
ScrubStack::enqueue_inode (in, header, on_finish, top)
| | _ _ call _ enqueue_inode () function to initialize the scrub of inode and insert in into the inode_stack array |
| | _ _ call kick_off_scrubs () function to perform scrub operation |
ScrubStack::kick_off_scrubs ()
| | _ _ traverse the inode_stack array from scratch and mds_max_scrub_ops_in_progress > scurbs_in_progress in the configuration file |
| | _ _ if the inode to be scrub is not a directory (normal file / symbolic link / hard link) |
| | _ _ call the pop_inode () function to delete the inode to be scrub from the inode_stack array |
| | _ _ if on_finish is not set in the inode of the scrub |
| | _ _ increment scrubs_in_progress |
| | _ _ set finisher callback function to scrub_tick |
| | _ _ call scrub_file_inode (curi) to perform the actual scrub operation |
| | _ _ set can_continue=true |
| | _ _ if the inode to be scrub is a directory |
| | _ _ call scrub_dir_inode () to perform the actual scrub operation |
| | _ _ if scrub operation is completed |
| | _ _ call pop_inode (curi) to delete the inode to be scrub from the inode_stack array |
| | _ _ if scrub operation is in progress |
| | _ _ fetch the next inode to be scrub from the first part of the inode_stack array |
ScrubStack::scrub_dir_inode (in, added_children, terminal, done)
| | _ _ get header information from the scrub_info of in |
| | _ _ if the recursive==true of header |
| | _ _ get the dirfrags of scrub operation from in, that is: in- > scrub_dirfrags_scrubbing (scrubbing_frags) |
| | _ _ traverse the scrubbing_frags array |
| | _ _ get the CDir class object corresponding to dirfrag |
| | _ _ if CDir class object is not empty |
| | _ _ insert CDir class objects into the scrubbing_cdirs array |
| | _ _ if CDir class object is empty |
| | _ _ complete the scrub operation of in's dirfrag, that is, in- > scrub_dirfrag_finished (* I) |
| | _ _ if msd_max_scrub_ops_in_progress > scrubs_in_progress in configuration file |
| | _ _ get a member from scrubbing_cdirs array |
| | _ if scrubbing _ cdirs is empty |
| | _ _ call the get_next_cdir () function to get the next directory to be scrub |
| | _ _ insert the directory to be scrub into scrubbing_cdirs array |
| | _ _ call scrub_dirfrag () to perform the actual scrub operation |
| | _ _ if all dirfrags have completed scrub |
| | _ _ call scrub_dir_inode_final (in) |
ScrubStack::get_next_cdir (in, new_dir)
| | _ _ get the next dirfrag to be scrub from in, that is, in- > scrub_dirfrag_next (next_frag) |
| | _ _ get the CDir information of the next scrub from in, namely: in- > get_or_open_dirfrag (mdcache, next_frag) |
| | _ _ if CDir is not complete |
| | _ _ increment scrubs_in_progress |
| | _ _ get the CDir information from the cluster, that is, next_dir- > fetch (scrub_tick) |
| | _ _ returns false |
| | _ _ set new_dir=next_dir |
| | _ _ returns true |
ScrubStack::scrub_dir_inode_final (in)
| | _ _ if children_scrubbed==0 in the scrub_info of in |
| | _ _ if the on_finish==0 of in's scrub_info |
| | _ _ increment scrubs_in_progress |
| | _ _ set the scrub finisher of in to scrub_tick |
| | _ _ execute the scrub_children_finished of in () |
| | _ _ execute the validate_disk_state of in () |
ScrubStack::scrub_dirfrag (dir, header, added_children, is_terminal, done)
| | _ _ if directory_scrubbing==0 in the scrub_info of dir |
| | _ _ if the dir is not completed |
| | _ _ increment scrubs_in_progress |
| | _ _ get the content of dir from the cluster, that is, dir- > fetch (scrub_kick) |
| | _ _ return directly |
| | _ _ execute the scrub_initialize () function of dir to initialize scrub |
| | _ _ execute the scrub_dentry_next () function of dir to get the next dentry to be scrub, namely: dir- > scrub_dentry_next () |
| | _ _ call _ enquue_inode () to insert the dentry to be scrub into the queue to be scrub |
ScrubStack::scrub_file_inode (in)
| | _ _ execute the validate_disk_state of in () |
ScrubStack::_validate_inode_done (in, r, result)
| | _ _ execute the scrub_finished () of in to indicate that the scrub work of the inode has been completed |
| | _ _ execute finisher- > queue () indicates that the scrub operation has been completed and the next operation needs to be performed |
The above is all the content of this article "what is the use of ScrubStack classes?" Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!