diff options
Diffstat (limited to 'fs/ocfs2')
-rw-r--r-- | fs/ocfs2/aops.c | 9 | ||||
-rw-r--r-- | fs/ocfs2/dlmfs/dlmfs.c | 15 | ||||
-rw-r--r-- | fs/ocfs2/file.c | 22 | ||||
-rw-r--r-- | fs/ocfs2/inode.c | 29 | ||||
-rw-r--r-- | fs/ocfs2/inode.h | 5 | ||||
-rw-r--r-- | fs/ocfs2/super.c | 3 |
6 files changed, 49 insertions, 34 deletions
diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c index 96337a4fbbdf..0de69c9a08be 100644 --- a/fs/ocfs2/aops.c +++ b/fs/ocfs2/aops.c | |||
@@ -643,11 +643,10 @@ static ssize_t ocfs2_direct_IO(int rw, | |||
643 | if (i_size_read(inode) <= offset) | 643 | if (i_size_read(inode) <= offset) |
644 | return 0; | 644 | return 0; |
645 | 645 | ||
646 | ret = blockdev_direct_IO_no_locking(rw, iocb, inode, | 646 | ret = __blockdev_direct_IO(rw, iocb, inode, inode->i_sb->s_bdev, |
647 | inode->i_sb->s_bdev, iov, offset, | 647 | iov, offset, nr_segs, |
648 | nr_segs, | 648 | ocfs2_direct_IO_get_blocks, |
649 | ocfs2_direct_IO_get_blocks, | 649 | ocfs2_dio_end_io, NULL, 0); |
650 | ocfs2_dio_end_io); | ||
651 | 650 | ||
652 | mlog_exit(ret); | 651 | mlog_exit(ret); |
653 | return ret; | 652 | return ret; |
diff --git a/fs/ocfs2/dlmfs/dlmfs.c b/fs/ocfs2/dlmfs/dlmfs.c index bef34d0528d5..c2903b84bb7a 100644 --- a/fs/ocfs2/dlmfs/dlmfs.c +++ b/fs/ocfs2/dlmfs/dlmfs.c | |||
@@ -213,10 +213,12 @@ static int dlmfs_file_setattr(struct dentry *dentry, struct iattr *attr) | |||
213 | 213 | ||
214 | attr->ia_valid &= ~ATTR_SIZE; | 214 | attr->ia_valid &= ~ATTR_SIZE; |
215 | error = inode_change_ok(inode, attr); | 215 | error = inode_change_ok(inode, attr); |
216 | if (!error) | 216 | if (error) |
217 | error = inode_setattr(inode, attr); | 217 | return error; |
218 | 218 | ||
219 | return error; | 219 | setattr_copy(inode, attr); |
220 | mark_inode_dirty(inode); | ||
221 | return 0; | ||
220 | } | 222 | } |
221 | 223 | ||
222 | static unsigned int dlmfs_file_poll(struct file *file, poll_table *wait) | 224 | static unsigned int dlmfs_file_poll(struct file *file, poll_table *wait) |
@@ -354,13 +356,12 @@ static void dlmfs_destroy_inode(struct inode *inode) | |||
354 | kmem_cache_free(dlmfs_inode_cache, DLMFS_I(inode)); | 356 | kmem_cache_free(dlmfs_inode_cache, DLMFS_I(inode)); |
355 | } | 357 | } |
356 | 358 | ||
357 | static void dlmfs_clear_inode(struct inode *inode) | 359 | static void dlmfs_evict_inode(struct inode *inode) |
358 | { | 360 | { |
359 | int status; | 361 | int status; |
360 | struct dlmfs_inode_private *ip; | 362 | struct dlmfs_inode_private *ip; |
361 | 363 | ||
362 | if (!inode) | 364 | end_writeback(inode); |
363 | return; | ||
364 | 365 | ||
365 | mlog(0, "inode %lu\n", inode->i_ino); | 366 | mlog(0, "inode %lu\n", inode->i_ino); |
366 | 367 | ||
@@ -630,7 +631,7 @@ static const struct super_operations dlmfs_ops = { | |||
630 | .statfs = simple_statfs, | 631 | .statfs = simple_statfs, |
631 | .alloc_inode = dlmfs_alloc_inode, | 632 | .alloc_inode = dlmfs_alloc_inode, |
632 | .destroy_inode = dlmfs_destroy_inode, | 633 | .destroy_inode = dlmfs_destroy_inode, |
633 | .clear_inode = dlmfs_clear_inode, | 634 | .evict_inode = dlmfs_evict_inode, |
634 | .drop_inode = generic_delete_inode, | 635 | .drop_inode = generic_delete_inode, |
635 | }; | 636 | }; |
636 | 637 | ||
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c index 2b10b36d1577..81296b4e3646 100644 --- a/fs/ocfs2/file.c +++ b/fs/ocfs2/file.c | |||
@@ -1233,18 +1233,26 @@ int ocfs2_setattr(struct dentry *dentry, struct iattr *attr) | |||
1233 | } | 1233 | } |
1234 | 1234 | ||
1235 | /* | 1235 | /* |
1236 | * This will intentionally not wind up calling simple_setsize(), | 1236 | * This will intentionally not wind up calling truncate_setsize(), |
1237 | * since all the work for a size change has been done above. | 1237 | * since all the work for a size change has been done above. |
1238 | * Otherwise, we could get into problems with truncate as | 1238 | * Otherwise, we could get into problems with truncate as |
1239 | * ip_alloc_sem is used there to protect against i_size | 1239 | * ip_alloc_sem is used there to protect against i_size |
1240 | * changes. | 1240 | * changes. |
1241 | * | ||
1242 | * XXX: this means the conditional below can probably be removed. | ||
1241 | */ | 1243 | */ |
1242 | status = inode_setattr(inode, attr); | 1244 | if ((attr->ia_valid & ATTR_SIZE) && |
1243 | if (status < 0) { | 1245 | attr->ia_size != i_size_read(inode)) { |
1244 | mlog_errno(status); | 1246 | status = vmtruncate(inode, attr->ia_size); |
1245 | goto bail_commit; | 1247 | if (status) { |
1248 | mlog_errno(status); | ||
1249 | goto bail_commit; | ||
1250 | } | ||
1246 | } | 1251 | } |
1247 | 1252 | ||
1253 | setattr_copy(inode, attr); | ||
1254 | mark_inode_dirty(inode); | ||
1255 | |||
1248 | status = ocfs2_mark_inode_dirty(handle, inode, bh); | 1256 | status = ocfs2_mark_inode_dirty(handle, inode, bh); |
1249 | if (status < 0) | 1257 | if (status < 0) |
1250 | mlog_errno(status); | 1258 | mlog_errno(status); |
@@ -2300,12 +2308,12 @@ relock: | |||
2300 | * blocks outside i_size. Trim these off again. | 2308 | * blocks outside i_size. Trim these off again. |
2301 | * Don't need i_size_read because we hold i_mutex. | 2309 | * Don't need i_size_read because we hold i_mutex. |
2302 | * | 2310 | * |
2303 | * XXX(hch): this looks buggy because ocfs2 did not | 2311 | * XXX(truncate): this looks buggy because ocfs2 did not |
2304 | * actually implement ->truncate. Take a look at | 2312 | * actually implement ->truncate. Take a look at |
2305 | * the new truncate sequence and update this accordingly | 2313 | * the new truncate sequence and update this accordingly |
2306 | */ | 2314 | */ |
2307 | if (*ppos + count > inode->i_size) | 2315 | if (*ppos + count > inode->i_size) |
2308 | simple_setsize(inode, inode->i_size); | 2316 | truncate_setsize(inode, inode->i_size); |
2309 | ret = written; | 2317 | ret = written; |
2310 | goto out_dio; | 2318 | goto out_dio; |
2311 | } | 2319 | } |
diff --git a/fs/ocfs2/inode.c b/fs/ocfs2/inode.c index abb0a95cc717..0492464916b1 100644 --- a/fs/ocfs2/inode.c +++ b/fs/ocfs2/inode.c | |||
@@ -969,7 +969,7 @@ static void ocfs2_cleanup_delete_inode(struct inode *inode, | |||
969 | truncate_inode_pages(&inode->i_data, 0); | 969 | truncate_inode_pages(&inode->i_data, 0); |
970 | } | 970 | } |
971 | 971 | ||
972 | void ocfs2_delete_inode(struct inode *inode) | 972 | static void ocfs2_delete_inode(struct inode *inode) |
973 | { | 973 | { |
974 | int wipe, status; | 974 | int wipe, status; |
975 | sigset_t oldset; | 975 | sigset_t oldset; |
@@ -1075,20 +1075,17 @@ bail_unlock_nfs_sync: | |||
1075 | bail_unblock: | 1075 | bail_unblock: |
1076 | ocfs2_unblock_signals(&oldset); | 1076 | ocfs2_unblock_signals(&oldset); |
1077 | bail: | 1077 | bail: |
1078 | clear_inode(inode); | ||
1079 | mlog_exit_void(); | 1078 | mlog_exit_void(); |
1080 | } | 1079 | } |
1081 | 1080 | ||
1082 | void ocfs2_clear_inode(struct inode *inode) | 1081 | static void ocfs2_clear_inode(struct inode *inode) |
1083 | { | 1082 | { |
1084 | int status; | 1083 | int status; |
1085 | struct ocfs2_inode_info *oi = OCFS2_I(inode); | 1084 | struct ocfs2_inode_info *oi = OCFS2_I(inode); |
1086 | 1085 | ||
1087 | mlog_entry_void(); | 1086 | mlog_entry_void(); |
1088 | 1087 | ||
1089 | if (!inode) | 1088 | end_writeback(inode); |
1090 | goto bail; | ||
1091 | |||
1092 | mlog(0, "Clearing inode: %llu, nlink = %u\n", | 1089 | mlog(0, "Clearing inode: %llu, nlink = %u\n", |
1093 | (unsigned long long)OCFS2_I(inode)->ip_blkno, inode->i_nlink); | 1090 | (unsigned long long)OCFS2_I(inode)->ip_blkno, inode->i_nlink); |
1094 | 1091 | ||
@@ -1180,16 +1177,27 @@ void ocfs2_clear_inode(struct inode *inode) | |||
1180 | jbd2_journal_release_jbd_inode(OCFS2_SB(inode->i_sb)->journal->j_journal, | 1177 | jbd2_journal_release_jbd_inode(OCFS2_SB(inode->i_sb)->journal->j_journal, |
1181 | &oi->ip_jinode); | 1178 | &oi->ip_jinode); |
1182 | 1179 | ||
1183 | bail: | ||
1184 | mlog_exit_void(); | 1180 | mlog_exit_void(); |
1185 | } | 1181 | } |
1186 | 1182 | ||
1183 | void ocfs2_evict_inode(struct inode *inode) | ||
1184 | { | ||
1185 | if (!inode->i_nlink || | ||
1186 | (OCFS2_I(inode)->ip_flags & OCFS2_INODE_MAYBE_ORPHANED)) { | ||
1187 | ocfs2_delete_inode(inode); | ||
1188 | } else { | ||
1189 | truncate_inode_pages(&inode->i_data, 0); | ||
1190 | } | ||
1191 | ocfs2_clear_inode(inode); | ||
1192 | } | ||
1193 | |||
1187 | /* Called under inode_lock, with no more references on the | 1194 | /* Called under inode_lock, with no more references on the |
1188 | * struct inode, so it's safe here to check the flags field | 1195 | * struct inode, so it's safe here to check the flags field |
1189 | * and to manipulate i_nlink without any other locks. */ | 1196 | * and to manipulate i_nlink without any other locks. */ |
1190 | void ocfs2_drop_inode(struct inode *inode) | 1197 | int ocfs2_drop_inode(struct inode *inode) |
1191 | { | 1198 | { |
1192 | struct ocfs2_inode_info *oi = OCFS2_I(inode); | 1199 | struct ocfs2_inode_info *oi = OCFS2_I(inode); |
1200 | int res; | ||
1193 | 1201 | ||
1194 | mlog_entry_void(); | 1202 | mlog_entry_void(); |
1195 | 1203 | ||
@@ -1197,11 +1205,12 @@ void ocfs2_drop_inode(struct inode *inode) | |||
1197 | (unsigned long long)oi->ip_blkno, inode->i_nlink, oi->ip_flags); | 1205 | (unsigned long long)oi->ip_blkno, inode->i_nlink, oi->ip_flags); |
1198 | 1206 | ||
1199 | if (oi->ip_flags & OCFS2_INODE_MAYBE_ORPHANED) | 1207 | if (oi->ip_flags & OCFS2_INODE_MAYBE_ORPHANED) |
1200 | generic_delete_inode(inode); | 1208 | res = 1; |
1201 | else | 1209 | else |
1202 | generic_drop_inode(inode); | 1210 | res = generic_drop_inode(inode); |
1203 | 1211 | ||
1204 | mlog_exit_void(); | 1212 | mlog_exit_void(); |
1213 | return res; | ||
1205 | } | 1214 | } |
1206 | 1215 | ||
1207 | /* | 1216 | /* |
diff --git a/fs/ocfs2/inode.h b/fs/ocfs2/inode.h index 9f5f5fcadc45..6de5a869db30 100644 --- a/fs/ocfs2/inode.h +++ b/fs/ocfs2/inode.h | |||
@@ -123,9 +123,8 @@ static inline struct ocfs2_caching_info *INODE_CACHE(struct inode *inode) | |||
123 | return &OCFS2_I(inode)->ip_metadata_cache; | 123 | return &OCFS2_I(inode)->ip_metadata_cache; |
124 | } | 124 | } |
125 | 125 | ||
126 | void ocfs2_clear_inode(struct inode *inode); | 126 | void ocfs2_evict_inode(struct inode *inode); |
127 | void ocfs2_delete_inode(struct inode *inode); | 127 | int ocfs2_drop_inode(struct inode *inode); |
128 | void ocfs2_drop_inode(struct inode *inode); | ||
129 | 128 | ||
130 | /* Flags for ocfs2_iget() */ | 129 | /* Flags for ocfs2_iget() */ |
131 | #define OCFS2_FI_FLAG_SYSFILE 0x1 | 130 | #define OCFS2_FI_FLAG_SYSFILE 0x1 |
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c index 03a799fdd740..fa1be1b304d1 100644 --- a/fs/ocfs2/super.c +++ b/fs/ocfs2/super.c | |||
@@ -145,8 +145,7 @@ static const struct super_operations ocfs2_sops = { | |||
145 | .alloc_inode = ocfs2_alloc_inode, | 145 | .alloc_inode = ocfs2_alloc_inode, |
146 | .destroy_inode = ocfs2_destroy_inode, | 146 | .destroy_inode = ocfs2_destroy_inode, |
147 | .drop_inode = ocfs2_drop_inode, | 147 | .drop_inode = ocfs2_drop_inode, |
148 | .clear_inode = ocfs2_clear_inode, | 148 | .evict_inode = ocfs2_evict_inode, |
149 | .delete_inode = ocfs2_delete_inode, | ||
150 | .sync_fs = ocfs2_sync_fs, | 149 | .sync_fs = ocfs2_sync_fs, |
151 | .put_super = ocfs2_put_super, | 150 | .put_super = ocfs2_put_super, |
152 | .remount_fs = ocfs2_remount, | 151 | .remount_fs = ocfs2_remount, |