mirror of
https://github.com/ceph/ceph
synced 2024-12-28 06:23:08 +00:00
mon/OSDMonitor: move (removed, purged) snap update into a helper
This is trivial at the moment, but we'll make it clever next. Signed-off-by: Sage Weil <sage@redhat.com>
This commit is contained in:
parent
c0233801a8
commit
1e7718c37c
@ -1582,21 +1582,18 @@ void OSDMonitor::encode_pending(MonitorDBStore::TransactionRef t)
|
||||
for (auto q = i.second.begin();
|
||||
q != i.second.end();
|
||||
++q) {
|
||||
bufferlist v;
|
||||
string k = make_removed_snap_key_value(i.first, q.get_start(),
|
||||
q.get_len(), pending_inc.epoch, &v);
|
||||
t->put(OSD_SNAP_PREFIX, k, v);
|
||||
insert_snap_update(false, i.first, q.get_start(), q.get_end(),
|
||||
pending_inc.epoch,
|
||||
t);
|
||||
}
|
||||
}
|
||||
for (auto& i : pending_inc.new_purged_snaps) {
|
||||
for (auto q = i.second.begin();
|
||||
q != i.second.end();
|
||||
++q) {
|
||||
bufferlist v;
|
||||
string k = make_snap_purged_key_value(i.first, q.get_start(),
|
||||
q.get_len(), pending_inc.epoch,
|
||||
&v);
|
||||
t->put(OSD_SNAP_PREFIX, k, v);
|
||||
insert_snap_update(true, i.first, q.get_start(), q.get_end(),
|
||||
pending_inc.epoch,
|
||||
t);
|
||||
}
|
||||
}
|
||||
|
||||
@ -6271,6 +6268,19 @@ int OSDMonitor::_lookup_snap(bool purged,
|
||||
return 0;
|
||||
}
|
||||
|
||||
void OSDMonitor::insert_snap_update(
|
||||
bool purged,
|
||||
int64_t pool,
|
||||
snapid_t start, snapid_t end,
|
||||
epoch_t epoch,
|
||||
MonitorDBStore::TransactionRef t)
|
||||
{
|
||||
bufferlist v;
|
||||
string k = _make_snap_key_value(purged, pool, start, end - start,
|
||||
pending_inc.epoch, &v);
|
||||
t->put(OSD_SNAP_PREFIX, k, v);
|
||||
}
|
||||
|
||||
bool OSDMonitor::try_prune_purged_snaps()
|
||||
{
|
||||
if (!mon->mgrstatmon()->is_readable()) {
|
||||
|
@ -536,6 +536,13 @@ private:
|
||||
return _lookup_snap(true, pool, snap, begin,end);
|
||||
}
|
||||
|
||||
void insert_snap_update(
|
||||
bool purged,
|
||||
int64_t pool,
|
||||
snapid_t start, snapid_t end,
|
||||
epoch_t epoch,
|
||||
MonitorDBStore::TransactionRef t);
|
||||
|
||||
bool prepare_set_flag(MonOpRequestRef op, int flag);
|
||||
bool prepare_unset_flag(MonOpRequestRef op, int flag);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user