Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7de9c6ee authored by Al Viro's avatar Al Viro
Browse files

new helper: ihold()



Clones an existing reference to inode; caller must already hold one.

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 646ec461
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -1789,9 +1789,10 @@ v9fs_vfs_link_dotl(struct dentry *old_dentry, struct inode *dir,
		kfree(st);
	} else {
		/* Caching disabled. No need to get upto date stat info.
		 * This dentry will be released immediately. So, just i_count++
		 * This dentry will be released immediately. So, just hold the
		 * inode
		 */
		atomic_inc(&old_dentry->d_inode->i_count);
		ihold(old_dentry->d_inode);
	}

	dentry->d_op = old_dentry->d_op;
+1 −1
Original line number Diff line number Diff line
@@ -388,7 +388,7 @@ affs_add_entry(struct inode *dir, struct inode *inode, struct dentry *dentry, s3
		affs_adjust_checksum(inode_bh, block - be32_to_cpu(chain));
		mark_buffer_dirty_inode(inode_bh, inode);
		inode->i_nlink = 2;
		atomic_inc(&inode->i_count);
		ihold(inode);
	}
	affs_fix_checksum(sb, bh);
	mark_buffer_dirty_inode(bh, inode);
+1 −1
Original line number Diff line number Diff line
@@ -1045,7 +1045,7 @@ static int afs_link(struct dentry *from, struct inode *dir,
	if (ret < 0)
		goto link_error;

	atomic_inc(&vnode->vfs_inode.i_count);
	ihold(&vnode->vfs_inode);
	d_instantiate(dentry, &vnode->vfs_inode);
	key_put(key);
	_leave(" = 0");
+2 −3
Original line number Diff line number Diff line
@@ -1553,10 +1553,9 @@ static void aio_batch_add(struct address_space *mapping,
	 *
	 * When we're called, we always have a reference
	 * on the file, so we must always have a reference
	 * on the inode, so igrab must always just
	 * bump the count and move on.
	 * on the inode, so ihold() is safe here.
	 */
	atomic_inc(&mapping->host->i_count);
	ihold(mapping->host);
	abe->mapping = mapping;
	hlist_add_head(&abe->list, &batch_hash[bucket]);
	return;
+2 −3
Original line number Diff line number Diff line
@@ -111,10 +111,9 @@ struct file *anon_inode_getfile(const char *name,
	path.mnt = mntget(anon_inode_mnt);
	/*
	 * We know the anon_inode inode count is always greater than zero,
	 * so we can avoid doing an igrab() and we can use an open-coded
	 * atomic_inc().
	 * so ihold() is safe.
	 */
	atomic_inc(&anon_inode_inode->i_count);
	ihold(anon_inode_inode);

	path.dentry->d_op = &anon_inodefs_dentry_operations;
	d_instantiate(path.dentry, anon_inode_inode);
Loading