mirror of
https://github.com/versity/scoutfs.git
synced 2026-07-31 04:23:28 +00:00
scoutfs: add scoutfs_lock_rename()
Add a specific lock method for locking the global rename lock instead of having the caller specify it as a global lock. We're getting rid of the notion of lock scopes and requiring all locks to be related to keys. The rename lock will use magic keys at the end of the volume. Signed-off-by: Zach Brown <zab@versity.com>
This commit is contained in:
+1
-3
@@ -1524,9 +1524,7 @@ static int scoutfs_rename(struct inode *old_dir, struct dentry *old_dentry,
|
||||
|
||||
/* if dirs are different make sure ancestor relationships are valid */
|
||||
if (old_dir != new_dir) {
|
||||
ret = scoutfs_lock_global(sb, DLM_LOCK_EX, 0,
|
||||
SCOUTFS_LOCK_TYPE_GLOBAL_RENAME,
|
||||
&rename_lock);
|
||||
ret = scoutfs_lock_rename(sb, DLM_LOCK_EX, 0, &rename_lock);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
||||
+3
-3
@@ -1019,16 +1019,16 @@ int scoutfs_lock_inodes(struct super_block *sb, int mode, int flags,
|
||||
}
|
||||
|
||||
/*
|
||||
* Acquire a cluster lock with a global scope in the lock space.
|
||||
* The rename lock is magical because it's global.
|
||||
*/
|
||||
int scoutfs_lock_global(struct super_block *sb, int mode, int flags, int type,
|
||||
int scoutfs_lock_rename(struct super_block *sb, int mode, int flags,
|
||||
struct scoutfs_lock **lock)
|
||||
{
|
||||
struct scoutfs_lock_name name;
|
||||
|
||||
memset(&name, 0, sizeof(name));
|
||||
name.scope = SCOUTFS_LOCK_SCOPE_GLOBAL;
|
||||
name.type = type;
|
||||
name.type = SCOUTFS_LOCK_TYPE_GLOBAL_RENAME;
|
||||
|
||||
return lock_name_keys(sb, mode, flags, &name, NULL, NULL, lock);
|
||||
}
|
||||
|
||||
+1
-1
@@ -66,7 +66,7 @@ int scoutfs_lock_inodes(struct super_block *sb, int mode, int flags,
|
||||
struct inode *b, struct scoutfs_lock **b_lock,
|
||||
struct inode *c, struct scoutfs_lock **c_lock,
|
||||
struct inode *d, struct scoutfs_lock **D_lock);
|
||||
int scoutfs_lock_global(struct super_block *sb, int mode, int flags, int type,
|
||||
int scoutfs_lock_rename(struct super_block *sb, int mode, int flags,
|
||||
struct scoutfs_lock **lock);
|
||||
int scoutfs_lock_node_id(struct super_block *sb, int mode, int flags,
|
||||
u64 node_id, struct scoutfs_lock **lock);
|
||||
|
||||
Reference in New Issue
Block a user