Skip to content

Commit

Permalink
Merge PR ceph#45224 into main
Browse files Browse the repository at this point in the history
* refs/pull/45224/head:
	mds: add support for snapshots alternate_name

Reviewed-by: Xiubo Li <[email protected]>
Reviewed-by: David Disseldorp <[email protected]>
Reviewed-by: Jeff Layton <[email protected]>
Reviewed-by: Venky Shankar <[email protected]>
  • Loading branch information
vshankar committed Mar 10, 2023
2 parents 81e27bd + f3b8b52 commit bfe00d4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/mds/Server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10791,8 +10791,10 @@ void Server::handle_client_lssnap(MDRequestRef& mdr)
break;

encode(snap_name, dnbl);

//infinite lease
LeaseStat e(CEPH_LEASE_VALID, -1, 0);
e.alternate_name = std::string(p->second->alternate_name);
mds->locker->encode_lease(dnbl, mdr->session->info, e);
dout(20) << "encode_infinite_lease" << dendl;

Expand Down Expand Up @@ -10956,6 +10958,7 @@ void Server::handle_client_mksnap(MDRequestRef& mdr)
info.ino = diri->ino();
info.snapid = snapid;
info.name = snapname;
info.alternate_name = req->get_alternate_name();
info.stamp = mdr->get_op_stamp();
info.metadata = payload.metadata;

Expand Down
8 changes: 6 additions & 2 deletions src/mds/snap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,25 +25,29 @@ using namespace std;

void SnapInfo::encode(bufferlist& bl) const
{
ENCODE_START(3, 2, bl);
ENCODE_START(4, 2, bl);
encode(snapid, bl);
encode(ino, bl);
encode(stamp, bl);
encode(name, bl);
encode(metadata, bl);
encode(alternate_name, bl);
ENCODE_FINISH(bl);
}

void SnapInfo::decode(bufferlist::const_iterator& bl)
{
DECODE_START_LEGACY_COMPAT_LEN(3, 2, 2, bl);
DECODE_START_LEGACY_COMPAT_LEN(4, 2, 2, bl);
decode(snapid, bl);
decode(ino, bl);
decode(stamp, bl);
decode(name, bl);
if (struct_v >= 3) {
decode(metadata, bl);
}
if (struct_v >= 4) {
decode(alternate_name, bl);
}
DECODE_FINISH(bl);
}

Expand Down
1 change: 1 addition & 0 deletions src/mds/snap.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ struct SnapInfo {
inodeno_t ino;
utime_t stamp;
std::string name;
std::string alternate_name;

mutable std::string long_name; ///< cached _$ino_$name
std::map<std::string,std::string> metadata;
Expand Down

0 comments on commit bfe00d4

Please sign in to comment.