scoutfs: rename scoutfs_inode_index_lock_hold

Call it scoutfs_inode_index_try_lock_hold since it may fail and unwind
as part of normal (not an error) operation. This lets us re-use the
name in an upcoming patch.

Signed-off-by: Mark Fasheh <mfasheh@versity.com>
This commit is contained in:
Mark Fasheh
2017-10-16 18:14:48 -05:00
committed by Zach Brown
parent afa30e60fe
commit dd99a0127e
5 changed files with 19 additions and 18 deletions

View File

@@ -1179,8 +1179,9 @@ static int scoutfs_write_begin(struct file *file,
ret = scoutfs_inode_index_start(sb, &ind_seq) ?:
scoutfs_inode_index_prepare(sb, &wbd->ind_locks, inode,
new_size, true) ?:
scoutfs_inode_index_lock_hold(sb, &wbd->ind_locks,
ind_seq, SIC_WRITE_BEGIN());
scoutfs_inode_index_try_lock_hold(sb, &wbd->ind_locks,
ind_seq,
SIC_WRITE_BEGIN());
} while (ret > 0);
if (ret < 0)
goto out;

View File

@@ -576,7 +576,7 @@ retry:
scoutfs_inode_index_prepare(sb, ind_locks, dir, dir_size, true) ?:
scoutfs_inode_index_prepare_ino(sb, ind_locks, ino, mode,
inode_size) ?:
scoutfs_inode_index_lock_hold(sb, ind_locks, ind_seq, cnt);
scoutfs_inode_index_try_lock_hold(sb, ind_locks, ind_seq, cnt);
if (ret > 0)
goto retry;
if (ret)
@@ -715,8 +715,8 @@ retry:
dir_size, false) ?:
scoutfs_inode_index_prepare(sb, &ind_locks, inode,
i_size_read(inode), false) ?:
scoutfs_inode_index_lock_hold(sb, &ind_locks, ind_seq,
SIC_LINK(dentry->d_name.len));
scoutfs_inode_index_try_lock_hold(sb, &ind_locks, ind_seq,
SIC_LINK(dentry->d_name.len));
if (ret > 0)
goto retry;
if (ret)
@@ -799,8 +799,8 @@ retry:
dir_size, false) ?:
scoutfs_inode_index_prepare(sb, &ind_locks, inode,
i_size_read(inode), false) ?:
scoutfs_inode_index_lock_hold(sb, &ind_locks, ind_seq,
SIC_UNLINK(dentry->d_name.len));
scoutfs_inode_index_try_lock_hold(sb, &ind_locks, ind_seq,
SIC_UNLINK(dentry->d_name.len));
if (ret > 0)
goto retry;
if (ret)
@@ -1465,7 +1465,7 @@ retry:
(new_inode == NULL ? 0 :
scoutfs_inode_index_prepare(sb, &ind_locks, new_inode,
i_size_read(new_inode), false)) ?:
scoutfs_inode_index_lock_hold(sb, &ind_locks, ind_seq,
scoutfs_inode_index_try_lock_hold(sb, &ind_locks, ind_seq,
SIC_RENAME(old_dentry->d_name.len,
new_dentry->d_name.len));
if (ret > 0)

View File

@@ -939,9 +939,9 @@ int scoutfs_inode_index_start(struct super_block *sb, u64 *seq)
*
* Returns > 0 if the seq changed and the locks should be retried.
*/
int scoutfs_inode_index_lock_hold(struct super_block *sb,
struct list_head *list, u64 seq,
const struct scoutfs_item_count cnt)
int scoutfs_inode_index_try_lock_hold(struct super_block *sb,
struct list_head *list, u64 seq,
const struct scoutfs_item_count cnt)
{
struct scoutfs_sb_info *sbi = SCOUTFS_SB(sb);
struct index_lock *ind_lock;
@@ -1273,8 +1273,8 @@ static int delete_inode_items(struct super_block *sb, u64 ino)
retry:
ret = scoutfs_inode_index_start(sb, &ind_seq) ?:
prepare_index_deletion(sb, &ind_locks, ino, mode, &sinode) ?:
scoutfs_inode_index_lock_hold(sb, &ind_locks, ind_seq,
SIC_DIRTY_INODE());
scoutfs_inode_index_try_lock_hold(sb, &ind_locks, ind_seq,
SIC_DIRTY_INODE());
if (ret > 0)
goto retry;
if (ret)

View File

@@ -69,9 +69,9 @@ int scoutfs_inode_index_prepare(struct super_block *sb, struct list_head *list,
int scoutfs_inode_index_prepare_ino(struct super_block *sb,
struct list_head *list, u64 ino,
umode_t mode, u64 new_size);
int scoutfs_inode_index_lock_hold(struct super_block *sb,
struct list_head *list, u64 seq,
const struct scoutfs_item_count cnt);
int scoutfs_inode_index_try_lock_hold(struct super_block *sb,
struct list_head *list, u64 seq,
const struct scoutfs_item_count cnt);
void scoutfs_inode_index_unlock(struct super_block *sb, struct list_head *list);
int scoutfs_dirty_inode_item(struct inode *inode, struct scoutfs_lock *lock);

View File

@@ -322,8 +322,8 @@ retry:
ret = scoutfs_inode_index_start(sb, &ind_seq) ?:
scoutfs_inode_index_prepare(sb, &ind_locks, inode,
i_size_read(inode), false) ?:
scoutfs_inode_index_lock_hold(sb, &ind_locks, ind_seq,
SIC_XATTR_SET(name_len, size));
scoutfs_inode_index_try_lock_hold(sb, &ind_locks, ind_seq,
SIC_XATTR_SET(name_len, size));
if (ret > 0)
goto retry;
if (ret)