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

Method insert_dentry_inode

src/client/Client.cc:1278–1326  ·  view source on GitHub ↗

* insert_dentry_inode - insert + link a single dentry + inode into the metadata cache. */

Source from the content-addressed store, hash-verified

1276 * insert_dentry_inode - insert + link a single dentry + inode into the metadata cache.
1277 */
1278Dentry *Client::insert_dentry_inode(Dir *dir, const string& dname, LeaseStat *dlease,
1279 Inode *in, utime_t from, MetaSession *session,
1280 Dentry *old_dentry)
1281{
1282 Dentry *dn = NULL;
1283 auto it = dir->dentries.find(dname);
1284 if (it != dir->dentries.end())
1285 dn = it->second;
1286
1287 ldout(cct, 12) << __func__ << " '" << dname << "' vino " << in->vino()
1288 << " in dir " << dir->parent_inode->vino() << " dn " << dn
1289 << dendl;
1290
1291 if (dn && dn->inode) {
1292 if (dn->inode->vino() == in->vino()) {
1293 touch_dn(dn);
1294 ldout(cct, 12) << " had dentry " << dname
1295 << " with correct vino " << dn->inode->vino()
1296 << dendl;
1297 } else {
1298 ldout(cct, 12) << " had dentry " << dname
1299 << " with WRONG vino " << dn->inode->vino()
1300 << dendl;
1301 unlink(dn, true, true); // keep dir, keep dentry
1302 }
1303 }
1304
1305 if (!dn || !dn->inode) {
1306 InodeRef tmp_ref(in);
1307 if (old_dentry) {
1308 if (old_dentry->dir != dir) {
1309 Inode *old_diri = old_dentry->dir->parent_inode;
1310 clear_dir_complete_and_ordered(old_diri, false);
1311 }
1312 unlink(old_dentry, dir == old_dentry->dir, false); // drop dentry, keep dir open if its the same dir
1313 }
1314 Inode *diri = dir->parent_inode;
1315 clear_dir_complete_and_ordered(diri, false);
1316 dn = link(dir, dname, in, dn);
1317
1318 if (old_dentry) {
1319 dn->is_renaming = false;
1320 signal_cond_list(waiting_for_rename);
1321 }
1322 }
1323
1324 update_dentry_lease(dn, dlease, from, session);
1325 return dn;
1326}
1327
1328bool Client::_wrap_name(Inode& diri, std::string& dname, std::string& alternate_name)
1329{

Callers

nothing calls this directly

Calls 3

findMethod · 0.45
endMethod · 0.45
vinoMethod · 0.45

Tested by

no test coverage detected