diff options
| author | Al Viro <viro@zeniv.linux.org.uk> | 2016-01-22 15:40:57 -0500 |
|---|---|---|
| committer | Al Viro <viro@zeniv.linux.org.uk> | 2016-01-22 18:04:28 -0500 |
| commit | 5955102c9984fa081b2d570cfac75c97eecf8f3b (patch) | |
| tree | a4744386eac4b916e847eb4eedfada158f6527b4 /fs/ceph/file.c | |
| parent | 57b8f112cfe6622ddddb8c2641206bb5fa8a112d (diff) | |
wrappers for ->i_mutex access
parallel to mutex_{lock,unlock,trylock,is_locked,lock_nested},
inode_foo(inode) being mutex_foo(&inode->i_mutex).
Please, use those for access to ->i_mutex; over the coming cycle
->i_mutex will become rwsem, with ->lookup() done with it held
only shared.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/ceph/file.c')
| -rw-r--r-- | fs/ceph/file.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/fs/ceph/file.c b/fs/ceph/file.c index 3c68e6aee2f0..10c5ae79696e 100644 --- a/fs/ceph/file.c +++ b/fs/ceph/file.c | |||
| @@ -1014,7 +1014,7 @@ static ssize_t ceph_write_iter(struct kiocb *iocb, struct iov_iter *from) | |||
| 1014 | if (!prealloc_cf) | 1014 | if (!prealloc_cf) |
| 1015 | return -ENOMEM; | 1015 | return -ENOMEM; |
| 1016 | 1016 | ||
| 1017 | mutex_lock(&inode->i_mutex); | 1017 | inode_lock(inode); |
| 1018 | 1018 | ||
| 1019 | /* We can write back this queue in page reclaim */ | 1019 | /* We can write back this queue in page reclaim */ |
| 1020 | current->backing_dev_info = inode_to_bdi(inode); | 1020 | current->backing_dev_info = inode_to_bdi(inode); |
| @@ -1070,7 +1070,7 @@ retry_snap: | |||
| 1070 | (iocb->ki_flags & IOCB_DIRECT) || (fi->flags & CEPH_F_SYNC)) { | 1070 | (iocb->ki_flags & IOCB_DIRECT) || (fi->flags & CEPH_F_SYNC)) { |
| 1071 | struct ceph_snap_context *snapc; | 1071 | struct ceph_snap_context *snapc; |
| 1072 | struct iov_iter data; | 1072 | struct iov_iter data; |
| 1073 | mutex_unlock(&inode->i_mutex); | 1073 | inode_unlock(inode); |
| 1074 | 1074 | ||
| 1075 | spin_lock(&ci->i_ceph_lock); | 1075 | spin_lock(&ci->i_ceph_lock); |
| 1076 | if (__ceph_have_pending_cap_snap(ci)) { | 1076 | if (__ceph_have_pending_cap_snap(ci)) { |
| @@ -1097,7 +1097,7 @@ retry_snap: | |||
| 1097 | "got EOLDSNAPC, retrying\n", | 1097 | "got EOLDSNAPC, retrying\n", |
| 1098 | inode, ceph_vinop(inode), | 1098 | inode, ceph_vinop(inode), |
| 1099 | pos, (unsigned)count); | 1099 | pos, (unsigned)count); |
| 1100 | mutex_lock(&inode->i_mutex); | 1100 | inode_lock(inode); |
| 1101 | goto retry_snap; | 1101 | goto retry_snap; |
| 1102 | } | 1102 | } |
| 1103 | if (written > 0) | 1103 | if (written > 0) |
| @@ -1117,7 +1117,7 @@ retry_snap: | |||
| 1117 | iocb->ki_pos = pos + written; | 1117 | iocb->ki_pos = pos + written; |
| 1118 | if (inode->i_size > old_size) | 1118 | if (inode->i_size > old_size) |
| 1119 | ceph_fscache_update_objectsize(inode); | 1119 | ceph_fscache_update_objectsize(inode); |
| 1120 | mutex_unlock(&inode->i_mutex); | 1120 | inode_unlock(inode); |
| 1121 | } | 1121 | } |
| 1122 | 1122 | ||
| 1123 | if (written >= 0) { | 1123 | if (written >= 0) { |
| @@ -1147,7 +1147,7 @@ retry_snap: | |||
| 1147 | goto out_unlocked; | 1147 | goto out_unlocked; |
| 1148 | 1148 | ||
| 1149 | out: | 1149 | out: |
| 1150 | mutex_unlock(&inode->i_mutex); | 1150 | inode_unlock(inode); |
| 1151 | out_unlocked: | 1151 | out_unlocked: |
| 1152 | ceph_free_cap_flush(prealloc_cf); | 1152 | ceph_free_cap_flush(prealloc_cf); |
| 1153 | current->backing_dev_info = NULL; | 1153 | current->backing_dev_info = NULL; |
| @@ -1162,7 +1162,7 @@ static loff_t ceph_llseek(struct file *file, loff_t offset, int whence) | |||
| 1162 | struct inode *inode = file->f_mapping->host; | 1162 | struct inode *inode = file->f_mapping->host; |
| 1163 | int ret; | 1163 | int ret; |
| 1164 | 1164 | ||
| 1165 | mutex_lock(&inode->i_mutex); | 1165 | inode_lock(inode); |
| 1166 | 1166 | ||
| 1167 | if (whence == SEEK_END || whence == SEEK_DATA || whence == SEEK_HOLE) { | 1167 | if (whence == SEEK_END || whence == SEEK_DATA || whence == SEEK_HOLE) { |
| 1168 | ret = ceph_do_getattr(inode, CEPH_STAT_CAP_SIZE, false); | 1168 | ret = ceph_do_getattr(inode, CEPH_STAT_CAP_SIZE, false); |
| @@ -1207,7 +1207,7 @@ static loff_t ceph_llseek(struct file *file, loff_t offset, int whence) | |||
| 1207 | offset = vfs_setpos(file, offset, inode->i_sb->s_maxbytes); | 1207 | offset = vfs_setpos(file, offset, inode->i_sb->s_maxbytes); |
| 1208 | 1208 | ||
| 1209 | out: | 1209 | out: |
| 1210 | mutex_unlock(&inode->i_mutex); | 1210 | inode_unlock(inode); |
| 1211 | return offset; | 1211 | return offset; |
| 1212 | } | 1212 | } |
| 1213 | 1213 | ||
| @@ -1363,7 +1363,7 @@ static long ceph_fallocate(struct file *file, int mode, | |||
| 1363 | if (!prealloc_cf) | 1363 | if (!prealloc_cf) |
| 1364 | return -ENOMEM; | 1364 | return -ENOMEM; |
| 1365 | 1365 | ||
| 1366 | mutex_lock(&inode->i_mutex); | 1366 | inode_lock(inode); |
| 1367 | 1367 | ||
| 1368 | if (ceph_snap(inode) != CEPH_NOSNAP) { | 1368 | if (ceph_snap(inode) != CEPH_NOSNAP) { |
| 1369 | ret = -EROFS; | 1369 | ret = -EROFS; |
| @@ -1418,7 +1418,7 @@ static long ceph_fallocate(struct file *file, int mode, | |||
| 1418 | 1418 | ||
| 1419 | ceph_put_cap_refs(ci, got); | 1419 | ceph_put_cap_refs(ci, got); |
| 1420 | unlock: | 1420 | unlock: |
| 1421 | mutex_unlock(&inode->i_mutex); | 1421 | inode_unlock(inode); |
| 1422 | ceph_free_cap_flush(prealloc_cf); | 1422 | ceph_free_cap_flush(prealloc_cf); |
| 1423 | return ret; | 1423 | return ret; |
| 1424 | } | 1424 | } |
