@@ -1693,6 +1693,11 @@ void OSDService::enqueue_front(OpSchedulerItem&& qi)
16931693 osd->op_shardedwq .queue_front (std::move (qi));
16941694}
16951695
1696+ double OSDService::get_cost_per_io () const
1697+ {
1698+ return osd->op_shardedwq .get_cost_per_io ();
1699+ }
1700+
16961701void OSDService::queue_recovery_context (
16971702 PG *pg,
16981703 GenContext<ThreadPool::TPHandle&> *c,
@@ -1761,56 +1766,66 @@ template <class MSG_TYPE>
17611766void OSDService::queue_scrub_event_msg (PG* pg,
17621767 Scrub::scrub_prio_t with_priority,
17631768 unsigned int qu_priority,
1764- Scrub::act_token_t act_token)
1769+ Scrub::act_token_t act_token,
1770+ uint64_t cost)
17651771{
17661772 const auto epoch = pg->get_osdmap_epoch ();
17671773 auto msg = new MSG_TYPE (pg->get_pgid (), epoch, act_token);
17681774 dout (15 ) << " queue a scrub event (" << *msg << " ) for " << *pg
17691775 << " . Epoch: " << epoch << " token: " << act_token << dendl;
17701776 enqueue_back (OpSchedulerItem (
1771- unique_ptr<OpSchedulerItem::OpQueueable>(msg), get_scrub_cost () ,
1777+ unique_ptr<OpSchedulerItem::OpQueueable>(msg), cost ,
17721778 pg->scrub_requeue_priority (with_priority, qu_priority), ceph_clock_now (), 0 , epoch));
17731779}
17741780
17751781template <class MSG_TYPE >
17761782void OSDService::queue_scrub_event_msg (PG* pg,
1777- Scrub::scrub_prio_t with_priority)
1783+ Scrub::scrub_prio_t with_priority,
1784+ uint64_t cost)
17781785{
17791786 const auto epoch = pg->get_osdmap_epoch ();
17801787 auto msg = new MSG_TYPE (pg->get_pgid (), epoch);
17811788 dout (15 ) << " queue a scrub event (" << *msg << " ) for " << *pg << " . Epoch: " << epoch << dendl;
17821789 enqueue_back (OpSchedulerItem (
1783- unique_ptr<OpSchedulerItem::OpQueueable>(msg), get_scrub_cost () ,
1790+ unique_ptr<OpSchedulerItem::OpQueueable>(msg), cost ,
17841791 pg->scrub_requeue_priority (with_priority), ceph_clock_now (), 0 , epoch));
17851792}
17861793
1787- int64_t OSDService::get_scrub_cost ()
1794+ template <class MSG_TYPE >
1795+ void OSDService::queue_scrub_event_msg_default_cost (PG* pg,
1796+ Scrub::scrub_prio_t with_priority,
1797+ unsigned int qu_priority,
1798+ Scrub::act_token_t act_token)
17881799{
1800+ uint64_t cost = cct->_conf ->osd_scrub_event_cost ;
1801+ queue_scrub_event_msg<MSG_TYPE>(pg, with_priority, qu_priority, act_token, cost);
1802+ }
17891803
1790- int64_t cost_for_queue = cct-> _conf -> osd_scrub_cost ;
1791- if ( op_queue_type_t :: mClockScheduler == osd-> osd_op_queue_type ()) {
1792- cost_for_queue = cct-> _conf -> osd_scrub_event_cost *
1793- cct-> _conf -> osd_shallow_scrub_chunk_max ;
1794- }
1795- return cost_for_queue ;
1804+ template < class MSG_TYPE >
1805+ void OSDService::queue_scrub_event_msg_default_cost (PG* pg,
1806+ Scrub:: scrub_prio_t with_priority)
1807+ {
1808+ uint64_t cost = cct-> _conf -> osd_scrub_event_cost ;
1809+ queue_scrub_event_msg<MSG_TYPE>(pg, with_priority, cost) ;
17961810}
17971811
17981812void OSDService::queue_for_scrub (PG* pg, Scrub::scrub_prio_t with_priority)
17991813{
1800- queue_scrub_event_msg <PGScrub>(pg, with_priority);
1814+ queue_scrub_event_msg_default_cost <PGScrub>(pg, with_priority);
18011815}
18021816
18031817void OSDService::queue_scrub_after_repair (PG* pg, Scrub::scrub_prio_t with_priority)
18041818{
1805- queue_scrub_event_msg <PGScrubAfterRepair>(pg, with_priority);
1819+ queue_scrub_event_msg_default_cost <PGScrubAfterRepair>(pg, with_priority);
18061820}
18071821
18081822void OSDService::queue_for_rep_scrub (PG* pg,
18091823 Scrub::scrub_prio_t with_priority,
18101824 unsigned int qu_priority,
1811- Scrub::act_token_t act_token)
1825+ Scrub::act_token_t act_token,
1826+ uint64_t cost)
18121827{
1813- queue_scrub_event_msg<PGRepScrub>(pg, with_priority, qu_priority, act_token);
1828+ queue_scrub_event_msg<PGRepScrub>(pg, with_priority, qu_priority, act_token, cost );
18141829}
18151830
18161831void OSDService::queue_for_rep_scrub_resched (PG* pg,
@@ -1819,73 +1834,73 @@ void OSDService::queue_for_rep_scrub_resched(PG* pg,
18191834 Scrub::act_token_t act_token)
18201835{
18211836 // Resulting scrub event: 'SchedReplica'
1822- queue_scrub_event_msg <PGRepScrubResched>(pg, with_priority, qu_priority,
1823- act_token);
1837+ queue_scrub_event_msg_default_cost <PGRepScrubResched>(pg, with_priority, qu_priority,
1838+ act_token);
18241839}
18251840
18261841void OSDService::queue_for_scrub_resched (PG* pg, Scrub::scrub_prio_t with_priority)
18271842{
18281843 // Resulting scrub event: 'InternalSchedScrub'
1829- queue_scrub_event_msg <PGScrubResched>(pg, with_priority);
1844+ queue_scrub_event_msg_default_cost <PGScrubResched>(pg, with_priority);
18301845}
18311846
18321847void OSDService::queue_scrub_pushes_update (PG* pg, Scrub::scrub_prio_t with_priority)
18331848{
18341849 // Resulting scrub event: 'ActivePushesUpd'
1835- queue_scrub_event_msg <PGScrubPushesUpdate>(pg, with_priority);
1850+ queue_scrub_event_msg_default_cost <PGScrubPushesUpdate>(pg, with_priority);
18361851}
18371852
1838- void OSDService::queue_scrub_chunk_free (PG* pg, Scrub::scrub_prio_t with_priority)
1853+ void OSDService::queue_scrub_chunk_free (PG* pg, Scrub::scrub_prio_t with_priority, uint64_t cost )
18391854{
18401855 // Resulting scrub event: 'SelectedChunkFree'
1841- queue_scrub_event_msg<PGScrubChunkIsFree>(pg, with_priority);
1856+ queue_scrub_event_msg<PGScrubChunkIsFree>(pg, with_priority, cost );
18421857}
18431858
18441859void OSDService::queue_scrub_chunk_busy (PG* pg, Scrub::scrub_prio_t with_priority)
18451860{
18461861 // Resulting scrub event: 'ChunkIsBusy'
1847- queue_scrub_event_msg <PGScrubChunkIsBusy>(pg, with_priority);
1862+ queue_scrub_event_msg_default_cost <PGScrubChunkIsBusy>(pg, with_priority);
18481863}
18491864
18501865void OSDService::queue_scrub_applied_update (PG* pg, Scrub::scrub_prio_t with_priority)
18511866{
1852- queue_scrub_event_msg <PGScrubAppliedUpdate>(pg, with_priority);
1867+ queue_scrub_event_msg_default_cost <PGScrubAppliedUpdate>(pg, with_priority);
18531868}
18541869
18551870void OSDService::queue_scrub_unblocking (PG* pg, Scrub::scrub_prio_t with_priority)
18561871{
18571872 // Resulting scrub event: 'Unblocked'
1858- queue_scrub_event_msg <PGScrubUnblocked>(pg, with_priority);
1873+ queue_scrub_event_msg_default_cost <PGScrubUnblocked>(pg, with_priority);
18591874}
18601875
18611876void OSDService::queue_scrub_digest_update (PG* pg, Scrub::scrub_prio_t with_priority)
18621877{
18631878 // Resulting scrub event: 'DigestUpdate'
1864- queue_scrub_event_msg <PGScrubDigestUpdate>(pg, with_priority);
1879+ queue_scrub_event_msg_default_cost <PGScrubDigestUpdate>(pg, with_priority);
18651880}
18661881
18671882void OSDService::queue_scrub_got_repl_maps (PG* pg, Scrub::scrub_prio_t with_priority)
18681883{
18691884 // Resulting scrub event: 'GotReplicas'
1870- queue_scrub_event_msg <PGScrubGotReplMaps>(pg, with_priority);
1885+ queue_scrub_event_msg_default_cost <PGScrubGotReplMaps>(pg, with_priority);
18711886}
18721887
18731888void OSDService::queue_scrub_replica_pushes (PG *pg, Scrub::scrub_prio_t with_priority)
18741889{
18751890 // Resulting scrub event: 'ReplicaPushesUpd'
1876- queue_scrub_event_msg <PGScrubReplicaPushes>(pg, with_priority);
1891+ queue_scrub_event_msg_default_cost <PGScrubReplicaPushes>(pg, with_priority);
18771892}
18781893
18791894void OSDService::queue_scrub_is_finished (PG *pg)
18801895{
18811896 // Resulting scrub event: 'ScrubFinished'
1882- queue_scrub_event_msg <PGScrubScrubFinished>(pg, Scrub::scrub_prio_t ::high_priority);
1897+ queue_scrub_event_msg_default_cost <PGScrubScrubFinished>(pg, Scrub::scrub_prio_t ::high_priority);
18831898}
18841899
18851900void OSDService::queue_scrub_next_chunk (PG *pg, Scrub::scrub_prio_t with_priority)
18861901{
18871902 // Resulting scrub event: 'NextChunk'
1888- queue_scrub_event_msg <PGScrubGetNextChunk>(pg, with_priority);
1903+ queue_scrub_event_msg_default_cost <PGScrubGetNextChunk>(pg, with_priority);
18891904}
18901905
18911906void OSDService::queue_for_pg_delete (spg_t pgid, epoch_t e, int64_t num_objects)
0 commit comments