aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJunxiao Bi <junxiao.bi@oracle.com>2013-09-11 17:19:45 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-09-11 18:56:30 -0400
commitf17c20dd2ec81e8ff328b81bc847da9429d0975b (patch)
tree288ff70d8c78e14f51dde033921ee0bc7072e4cd
parent2b1e55c389105b722cccadfa47f5615f57d8887f (diff)
ocfs2: use i_size_read() to access i_size
Though ocfs2 uses inode->i_mutex to protect i_size, there are both i_size_read/write() and direct accesses. Clean up all direct access to eliminate confusion. Signed-off-by: Junxiao Bi <junxiao.bi@oracle.com> Cc: Jie Liu <jeff.liu@oracle.com> Cc: Mark Fasheh <mfasheh@suse.com> Cc: Joel Becker <jlbec@evilplan.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--fs/ocfs2/aops.c2
-rw-r--r--fs/ocfs2/extent_map.c10
-rw-r--r--fs/ocfs2/ioctl.c2
-rw-r--r--fs/ocfs2/journal.c8
-rw-r--r--fs/ocfs2/move_extents.c2
-rw-r--r--fs/ocfs2/quota_global.c6
-rw-r--r--fs/ocfs2/quota_local.c12
7 files changed, 21 insertions, 21 deletions
diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c
index 94417a85ce6e..f37d3c0e2053 100644
--- a/fs/ocfs2/aops.c
+++ b/fs/ocfs2/aops.c
@@ -2044,7 +2044,7 @@ int ocfs2_write_end_nolock(struct address_space *mapping,
2044 2044
2045out_write_size: 2045out_write_size:
2046 pos += copied; 2046 pos += copied;
2047 if (pos > inode->i_size) { 2047 if (pos > i_size_read(inode)) {
2048 i_size_write(inode, pos); 2048 i_size_write(inode, pos);
2049 mark_inode_dirty(inode); 2049 mark_inode_dirty(inode);
2050 } 2050 }
diff --git a/fs/ocfs2/extent_map.c b/fs/ocfs2/extent_map.c
index 2487116d0d33..4bf2b763467f 100644
--- a/fs/ocfs2/extent_map.c
+++ b/fs/ocfs2/extent_map.c
@@ -852,20 +852,20 @@ int ocfs2_seek_data_hole_offset(struct file *file, loff_t *offset, int whence)
852 852
853 down_read(&OCFS2_I(inode)->ip_alloc_sem); 853 down_read(&OCFS2_I(inode)->ip_alloc_sem);
854 854
855 if (*offset >= inode->i_size) { 855 if (*offset >= i_size_read(inode)) {
856 ret = -ENXIO; 856 ret = -ENXIO;
857 goto out_unlock; 857 goto out_unlock;
858 } 858 }
859 859
860 if (OCFS2_I(inode)->ip_dyn_features & OCFS2_INLINE_DATA_FL) { 860 if (OCFS2_I(inode)->ip_dyn_features & OCFS2_INLINE_DATA_FL) {
861 if (whence == SEEK_HOLE) 861 if (whence == SEEK_HOLE)
862 *offset = inode->i_size; 862 *offset = i_size_read(inode);
863 goto out_unlock; 863 goto out_unlock;
864 } 864 }
865 865
866 clen = 0; 866 clen = 0;
867 cpos = *offset >> cs_bits; 867 cpos = *offset >> cs_bits;
868 cend = ocfs2_clusters_for_bytes(inode->i_sb, inode->i_size); 868 cend = ocfs2_clusters_for_bytes(inode->i_sb, i_size_read(inode));
869 869
870 while (cpos < cend && !is_last) { 870 while (cpos < cend && !is_last) {
871 ret = ocfs2_get_clusters_nocache(inode, di_bh, cpos, &hole_size, 871 ret = ocfs2_get_clusters_nocache(inode, di_bh, cpos, &hole_size,
@@ -904,8 +904,8 @@ int ocfs2_seek_data_hole_offset(struct file *file, loff_t *offset, int whence)
904 extlen = clen; 904 extlen = clen;
905 extlen <<= cs_bits; 905 extlen <<= cs_bits;
906 906
907 if ((extoff + extlen) > inode->i_size) 907 if ((extoff + extlen) > i_size_read(inode))
908 extlen = inode->i_size - extoff; 908 extlen = i_size_read(inode) - extoff;
909 extoff += extlen; 909 extoff += extlen;
910 if (extoff > *offset) 910 if (extoff > *offset)
911 *offset = extoff; 911 *offset = extoff;
diff --git a/fs/ocfs2/ioctl.c b/fs/ocfs2/ioctl.c
index 0c60ef2d8056..fa32ce9b455d 100644
--- a/fs/ocfs2/ioctl.c
+++ b/fs/ocfs2/ioctl.c
@@ -303,7 +303,7 @@ int ocfs2_info_handle_journal_size(struct inode *inode,
303 if (o2info_from_user(oij, req)) 303 if (o2info_from_user(oij, req))
304 goto bail; 304 goto bail;
305 305
306 oij.ij_journal_size = osb->journal->j_inode->i_size; 306 oij.ij_journal_size = i_size_read(osb->journal->j_inode);
307 307
308 o2info_set_request_filled(&oij.ij_req); 308 o2info_set_request_filled(&oij.ij_req);
309 309
diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c
index a126cb37ca4d..44fc3e530c3d 100644
--- a/fs/ocfs2/journal.c
+++ b/fs/ocfs2/journal.c
@@ -836,14 +836,14 @@ int ocfs2_journal_init(struct ocfs2_journal *journal, int *dirty)
836 inode_lock = 1; 836 inode_lock = 1;
837 di = (struct ocfs2_dinode *)bh->b_data; 837 di = (struct ocfs2_dinode *)bh->b_data;
838 838
839 if (inode->i_size < OCFS2_MIN_JOURNAL_SIZE) { 839 if (i_size_read(inode) < OCFS2_MIN_JOURNAL_SIZE) {
840 mlog(ML_ERROR, "Journal file size (%lld) is too small!\n", 840 mlog(ML_ERROR, "Journal file size (%lld) is too small!\n",
841 inode->i_size); 841 i_size_read(inode));
842 status = -EINVAL; 842 status = -EINVAL;
843 goto done; 843 goto done;
844 } 844 }
845 845
846 trace_ocfs2_journal_init(inode->i_size, 846 trace_ocfs2_journal_init(i_size_read(inode),
847 (unsigned long long)inode->i_blocks, 847 (unsigned long long)inode->i_blocks,
848 OCFS2_I(inode)->ip_clusters); 848 OCFS2_I(inode)->ip_clusters);
849 849
@@ -1131,7 +1131,7 @@ static int ocfs2_force_read_journal(struct inode *inode)
1131 1131
1132 memset(bhs, 0, sizeof(struct buffer_head *) * CONCURRENT_JOURNAL_FILL); 1132 memset(bhs, 0, sizeof(struct buffer_head *) * CONCURRENT_JOURNAL_FILL);
1133 1133
1134 num_blocks = ocfs2_blocks_for_bytes(inode->i_sb, inode->i_size); 1134 num_blocks = ocfs2_blocks_for_bytes(inode->i_sb, i_size_read(inode));
1135 v_blkno = 0; 1135 v_blkno = 0;
1136 while (v_blkno < num_blocks) { 1136 while (v_blkno < num_blocks) {
1137 status = ocfs2_extent_map_get_blocks(inode, v_blkno, 1137 status = ocfs2_extent_map_get_blocks(inode, v_blkno,
diff --git a/fs/ocfs2/move_extents.c b/fs/ocfs2/move_extents.c
index 452068b45749..415928536c5e 100644
--- a/fs/ocfs2/move_extents.c
+++ b/fs/ocfs2/move_extents.c
@@ -845,7 +845,7 @@ static int __ocfs2_move_extents_range(struct buffer_head *di_bh,
845 struct ocfs2_move_extents *range = context->range; 845 struct ocfs2_move_extents *range = context->range;
846 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); 846 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
847 847
848 if ((inode->i_size == 0) || (range->me_len == 0)) 848 if ((i_size_read(inode) == 0) || (range->me_len == 0))
849 return 0; 849 return 0;
850 850
851 if (OCFS2_I(inode)->ip_dyn_features & OCFS2_INLINE_DATA_FL) 851 if (OCFS2_I(inode)->ip_dyn_features & OCFS2_INLINE_DATA_FL)
diff --git a/fs/ocfs2/quota_global.c b/fs/ocfs2/quota_global.c
index 332a281f217e..aaa50611ec66 100644
--- a/fs/ocfs2/quota_global.c
+++ b/fs/ocfs2/quota_global.c
@@ -234,7 +234,7 @@ ssize_t ocfs2_quota_write(struct super_block *sb, int type,
234 len = sb->s_blocksize - OCFS2_QBLK_RESERVED_SPACE - offset; 234 len = sb->s_blocksize - OCFS2_QBLK_RESERVED_SPACE - offset;
235 } 235 }
236 236
237 if (gqinode->i_size < off + len) { 237 if (i_size_read(gqinode) < off + len) {
238 loff_t rounded_end = 238 loff_t rounded_end =
239 ocfs2_align_bytes_to_blocks(sb, off + len); 239 ocfs2_align_bytes_to_blocks(sb, off + len);
240 240
@@ -778,8 +778,8 @@ static int ocfs2_acquire_dquot(struct dquot *dquot)
778 */ 778 */
779 WARN_ON(journal_current_handle()); 779 WARN_ON(journal_current_handle());
780 status = ocfs2_extend_no_holes(gqinode, NULL, 780 status = ocfs2_extend_no_holes(gqinode, NULL,
781 gqinode->i_size + (need_alloc << sb->s_blocksize_bits), 781 i_size_read(gqinode) + (need_alloc << sb->s_blocksize_bits),
782 gqinode->i_size); 782 i_size_read(gqinode));
783 if (status < 0) 783 if (status < 0)
784 goto out_dq; 784 goto out_dq;
785 } 785 }
diff --git a/fs/ocfs2/quota_local.c b/fs/ocfs2/quota_local.c
index 27fe7ee4874c..2e4344be3b96 100644
--- a/fs/ocfs2/quota_local.c
+++ b/fs/ocfs2/quota_local.c
@@ -982,14 +982,14 @@ static struct ocfs2_quota_chunk *ocfs2_local_quota_add_chunk(
982 982
983 /* We are protected by dqio_sem so no locking needed */ 983 /* We are protected by dqio_sem so no locking needed */
984 status = ocfs2_extend_no_holes(lqinode, NULL, 984 status = ocfs2_extend_no_holes(lqinode, NULL,
985 lqinode->i_size + 2 * sb->s_blocksize, 985 i_size_read(lqinode) + 2 * sb->s_blocksize,
986 lqinode->i_size); 986 i_size_read(lqinode));
987 if (status < 0) { 987 if (status < 0) {
988 mlog_errno(status); 988 mlog_errno(status);
989 goto out; 989 goto out;
990 } 990 }
991 status = ocfs2_simple_size_update(lqinode, oinfo->dqi_lqi_bh, 991 status = ocfs2_simple_size_update(lqinode, oinfo->dqi_lqi_bh,
992 lqinode->i_size + 2 * sb->s_blocksize); 992 i_size_read(lqinode) + 2 * sb->s_blocksize);
993 if (status < 0) { 993 if (status < 0) {
994 mlog_errno(status); 994 mlog_errno(status);
995 goto out; 995 goto out;
@@ -1125,14 +1125,14 @@ static struct ocfs2_quota_chunk *ocfs2_extend_local_quota_file(
1125 1125
1126 /* We are protected by dqio_sem so no locking needed */ 1126 /* We are protected by dqio_sem so no locking needed */
1127 status = ocfs2_extend_no_holes(lqinode, NULL, 1127 status = ocfs2_extend_no_holes(lqinode, NULL,
1128 lqinode->i_size + sb->s_blocksize, 1128 i_size_read(lqinode) + sb->s_blocksize,
1129 lqinode->i_size); 1129 i_size_read(lqinode));
1130 if (status < 0) { 1130 if (status < 0) {
1131 mlog_errno(status); 1131 mlog_errno(status);
1132 goto out; 1132 goto out;
1133 } 1133 }
1134 status = ocfs2_simple_size_update(lqinode, oinfo->dqi_lqi_bh, 1134 status = ocfs2_simple_size_update(lqinode, oinfo->dqi_lqi_bh,
1135 lqinode->i_size + sb->s_blocksize); 1135 i_size_read(lqinode) + sb->s_blocksize);
1136 if (status < 0) { 1136 if (status < 0) {
1137 mlog_errno(status); 1137 mlog_errno(status);
1138 goto out; 1138 goto out;