aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs')
-rw-r--r--fs/xfs/Makefile-linux-2.61
-rw-r--r--fs/xfs/linux-2.6/xfs_aops.c4
-rw-r--r--fs/xfs/linux-2.6/xfs_lrw.c55
-rw-r--r--fs/xfs/linux-2.6/xfs_lrw.h13
-rw-r--r--fs/xfs/xfs_dfrag.c2
-rw-r--r--fs/xfs/xfs_iget.c13
-rw-r--r--fs/xfs/xfs_inode.c4
-rw-r--r--fs/xfs/xfs_inode.h43
-rw-r--r--fs/xfs/xfs_iocore.c79
-rw-r--r--fs/xfs/xfs_iomap.c30
-rw-r--r--fs/xfs/xfs_mount.h1
-rw-r--r--fs/xfs/xfs_rw.h8
-rw-r--r--fs/xfs/xfs_vnodeops.c12
13 files changed, 54 insertions, 211 deletions
diff --git a/fs/xfs/Makefile-linux-2.6 b/fs/xfs/Makefile-linux-2.6
index d1491aa7a0e2..97316451fc6d 100644
--- a/fs/xfs/Makefile-linux-2.6
+++ b/fs/xfs/Makefile-linux-2.6
@@ -70,7 +70,6 @@ xfs-y += xfs_alloc.o \
70 xfs_iget.o \ 70 xfs_iget.o \
71 xfs_inode.o \ 71 xfs_inode.o \
72 xfs_inode_item.o \ 72 xfs_inode_item.o \
73 xfs_iocore.o \
74 xfs_iomap.o \ 73 xfs_iomap.o \
75 xfs_itable.o \ 74 xfs_itable.o \
76 xfs_dfrag.o \ 75 xfs_dfrag.o \
diff --git a/fs/xfs/linux-2.6/xfs_aops.c b/fs/xfs/linux-2.6/xfs_aops.c
index d20df3918650..36dadc4ff22c 100644
--- a/fs/xfs/linux-2.6/xfs_aops.c
+++ b/fs/xfs/linux-2.6/xfs_aops.c
@@ -163,7 +163,7 @@ xfs_destroy_ioend(
163/* 163/*
164 * Update on-disk file size now that data has been written to disk. 164 * Update on-disk file size now that data has been written to disk.
165 * The current in-memory file size is i_size. If a write is beyond 165 * The current in-memory file size is i_size. If a write is beyond
166 * eof io_new_size will be the intended file size until i_size is 166 * eof i_new_size will be the intended file size until i_size is
167 * updated. If this write does not extend all the way to the valid 167 * updated. If this write does not extend all the way to the valid
168 * file size then restrict this update to the end of the write. 168 * file size then restrict this update to the end of the write.
169 */ 169 */
@@ -185,7 +185,7 @@ xfs_setfilesize(
185 185
186 xfs_ilock(ip, XFS_ILOCK_EXCL); 186 xfs_ilock(ip, XFS_ILOCK_EXCL);
187 187
188 isize = MAX(ip->i_size, ip->i_iocore.io_new_size); 188 isize = MAX(ip->i_size, ip->i_new_size);
189 isize = MIN(isize, bsize); 189 isize = MIN(isize, bsize);
190 190
191 if (ip->i_d.di_size < isize) { 191 if (ip->i_d.di_size < isize) {
diff --git a/fs/xfs/linux-2.6/xfs_lrw.c b/fs/xfs/linux-2.6/xfs_lrw.c
index 0abc7d0586c9..459d36480b16 100644
--- a/fs/xfs/linux-2.6/xfs_lrw.c
+++ b/fs/xfs/linux-2.6/xfs_lrw.c
@@ -58,14 +58,12 @@
58void 58void
59xfs_rw_enter_trace( 59xfs_rw_enter_trace(
60 int tag, 60 int tag,
61 xfs_iocore_t *io, 61 xfs_inode_t *ip,
62 void *data, 62 void *data,
63 size_t segs, 63 size_t segs,
64 loff_t offset, 64 loff_t offset,
65 int ioflags) 65 int ioflags)
66{ 66{
67 xfs_inode_t *ip = XFS_IO_INODE(io);
68
69 if (ip->i_rwtrace == NULL) 67 if (ip->i_rwtrace == NULL)
70 return; 68 return;
71 ktrace_enter(ip->i_rwtrace, 69 ktrace_enter(ip->i_rwtrace,
@@ -78,8 +76,8 @@ xfs_rw_enter_trace(
78 (void *)((unsigned long)((offset >> 32) & 0xffffffff)), 76 (void *)((unsigned long)((offset >> 32) & 0xffffffff)),
79 (void *)((unsigned long)(offset & 0xffffffff)), 77 (void *)((unsigned long)(offset & 0xffffffff)),
80 (void *)((unsigned long)ioflags), 78 (void *)((unsigned long)ioflags),
81 (void *)((unsigned long)((io->io_new_size >> 32) & 0xffffffff)), 79 (void *)((unsigned long)((ip->i_new_size >> 32) & 0xffffffff)),
82 (void *)((unsigned long)(io->io_new_size & 0xffffffff)), 80 (void *)((unsigned long)(ip->i_new_size & 0xffffffff)),
83 (void *)((unsigned long)current_pid()), 81 (void *)((unsigned long)current_pid()),
84 (void *)NULL, 82 (void *)NULL,
85 (void *)NULL, 83 (void *)NULL,
@@ -89,13 +87,12 @@ xfs_rw_enter_trace(
89 87
90void 88void
91xfs_inval_cached_trace( 89xfs_inval_cached_trace(
92 xfs_iocore_t *io, 90 xfs_inode_t *ip,
93 xfs_off_t offset, 91 xfs_off_t offset,
94 xfs_off_t len, 92 xfs_off_t len,
95 xfs_off_t first, 93 xfs_off_t first,
96 xfs_off_t last) 94 xfs_off_t last)
97{ 95{
98 xfs_inode_t *ip = XFS_IO_INODE(io);
99 96
100 if (ip->i_rwtrace == NULL) 97 if (ip->i_rwtrace == NULL)
101 return; 98 return;
@@ -256,7 +253,7 @@ xfs_read(
256 } 253 }
257 } 254 }
258 255
259 xfs_rw_enter_trace(XFS_READ_ENTER, &ip->i_iocore, 256 xfs_rw_enter_trace(XFS_READ_ENTER, ip,
260 (void *)iovp, segs, *offset, ioflags); 257 (void *)iovp, segs, *offset, ioflags);
261 258
262 iocb->ki_pos = *offset; 259 iocb->ki_pos = *offset;
@@ -301,7 +298,7 @@ xfs_splice_read(
301 return -error; 298 return -error;
302 } 299 }
303 } 300 }
304 xfs_rw_enter_trace(XFS_SPLICE_READ_ENTER, &ip->i_iocore, 301 xfs_rw_enter_trace(XFS_SPLICE_READ_ENTER, ip,
305 pipe, count, *ppos, ioflags); 302 pipe, count, *ppos, ioflags);
306 ret = generic_file_splice_read(infilp, ppos, pipe, count, flags); 303 ret = generic_file_splice_read(infilp, ppos, pipe, count, flags);
307 if (ret > 0) 304 if (ret > 0)
@@ -323,7 +320,6 @@ xfs_splice_write(
323{ 320{
324 bhv_vnode_t *vp = XFS_ITOV(ip); 321 bhv_vnode_t *vp = XFS_ITOV(ip);
325 xfs_mount_t *mp = ip->i_mount; 322 xfs_mount_t *mp = ip->i_mount;
326 xfs_iocore_t *io = &ip->i_iocore;
327 ssize_t ret; 323 ssize_t ret;
328 struct inode *inode = outfilp->f_mapping->host; 324 struct inode *inode = outfilp->f_mapping->host;
329 xfs_fsize_t isize, new_size; 325 xfs_fsize_t isize, new_size;
@@ -350,10 +346,10 @@ xfs_splice_write(
350 346
351 xfs_ilock(ip, XFS_ILOCK_EXCL); 347 xfs_ilock(ip, XFS_ILOCK_EXCL);
352 if (new_size > ip->i_size) 348 if (new_size > ip->i_size)
353 io->io_new_size = new_size; 349 ip->i_new_size = new_size;
354 xfs_iunlock(ip, XFS_ILOCK_EXCL); 350 xfs_iunlock(ip, XFS_ILOCK_EXCL);
355 351
356 xfs_rw_enter_trace(XFS_SPLICE_WRITE_ENTER, &ip->i_iocore, 352 xfs_rw_enter_trace(XFS_SPLICE_WRITE_ENTER, ip,
357 pipe, count, *ppos, ioflags); 353 pipe, count, *ppos, ioflags);
358 ret = generic_file_splice_write(pipe, outfilp, ppos, count, flags); 354 ret = generic_file_splice_write(pipe, outfilp, ppos, count, flags);
359 if (ret > 0) 355 if (ret > 0)
@@ -370,9 +366,9 @@ xfs_splice_write(
370 xfs_iunlock(ip, XFS_ILOCK_EXCL); 366 xfs_iunlock(ip, XFS_ILOCK_EXCL);
371 } 367 }
372 368
373 if (io->io_new_size) { 369 if (ip->i_new_size) {
374 xfs_ilock(ip, XFS_ILOCK_EXCL); 370 xfs_ilock(ip, XFS_ILOCK_EXCL);
375 io->io_new_size = 0; 371 ip->i_new_size = 0;
376 if (ip->i_d.di_size > ip->i_size) 372 if (ip->i_d.di_size > ip->i_size)
377 ip->i_d.di_size = ip->i_size; 373 ip->i_d.di_size = ip->i_size;
378 xfs_iunlock(ip, XFS_ILOCK_EXCL); 374 xfs_iunlock(ip, XFS_ILOCK_EXCL);
@@ -461,20 +457,19 @@ xfs_zero_eof(
461 xfs_off_t offset, /* starting I/O offset */ 457 xfs_off_t offset, /* starting I/O offset */
462 xfs_fsize_t isize) /* current inode size */ 458 xfs_fsize_t isize) /* current inode size */
463{ 459{
464 xfs_iocore_t *io = &ip->i_iocore; 460 xfs_mount_t *mp = ip->i_mount;
465 xfs_fileoff_t start_zero_fsb; 461 xfs_fileoff_t start_zero_fsb;
466 xfs_fileoff_t end_zero_fsb; 462 xfs_fileoff_t end_zero_fsb;
467 xfs_fileoff_t zero_count_fsb; 463 xfs_fileoff_t zero_count_fsb;
468 xfs_fileoff_t last_fsb; 464 xfs_fileoff_t last_fsb;
469 xfs_fileoff_t zero_off; 465 xfs_fileoff_t zero_off;
470 xfs_fsize_t zero_len; 466 xfs_fsize_t zero_len;
471 xfs_mount_t *mp = io->io_mount;
472 int nimaps; 467 int nimaps;
473 int error = 0; 468 int error = 0;
474 xfs_bmbt_irec_t imap; 469 xfs_bmbt_irec_t imap;
475 470
476 ASSERT(ismrlocked(io->io_lock, MR_UPDATE)); 471 ASSERT(ismrlocked(&ip->i_lock, MR_UPDATE));
477 ASSERT(ismrlocked(io->io_iolock, MR_UPDATE)); 472 ASSERT(ismrlocked(&ip->i_iolock, MR_UPDATE));
478 ASSERT(offset > isize); 473 ASSERT(offset > isize);
479 474
480 /* 475 /*
@@ -483,8 +478,8 @@ xfs_zero_eof(
483 */ 478 */
484 error = xfs_zero_last_block(ip, offset, isize); 479 error = xfs_zero_last_block(ip, offset, isize);
485 if (error) { 480 if (error) {
486 ASSERT(ismrlocked(io->io_lock, MR_UPDATE)); 481 ASSERT(ismrlocked(&ip->i_lock, MR_UPDATE));
487 ASSERT(ismrlocked(io->io_iolock, MR_UPDATE)); 482 ASSERT(ismrlocked(&ip->i_iolock, MR_UPDATE));
488 return error; 483 return error;
489 } 484 }
490 485
@@ -515,8 +510,8 @@ xfs_zero_eof(
515 error = xfs_bmapi(NULL, ip, start_zero_fsb, zero_count_fsb, 510 error = xfs_bmapi(NULL, ip, start_zero_fsb, zero_count_fsb,
516 0, NULL, 0, &imap, &nimaps, NULL, NULL); 511 0, NULL, 0, &imap, &nimaps, NULL, NULL);
517 if (error) { 512 if (error) {
518 ASSERT(ismrlocked(io->io_lock, MR_UPDATE)); 513 ASSERT(ismrlocked(&ip->i_lock, MR_UPDATE));
519 ASSERT(ismrlocked(io->io_iolock, MR_UPDATE)); 514 ASSERT(ismrlocked(&ip->i_iolock, MR_UPDATE));
520 return error; 515 return error;
521 } 516 }
522 ASSERT(nimaps > 0); 517 ASSERT(nimaps > 0);
@@ -584,7 +579,6 @@ xfs_write(
584 xfs_mount_t *mp; 579 xfs_mount_t *mp;
585 ssize_t ret = 0, error = 0; 580 ssize_t ret = 0, error = 0;
586 xfs_fsize_t isize, new_size; 581 xfs_fsize_t isize, new_size;
587 xfs_iocore_t *io;
588 int iolock; 582 int iolock;
589 int eventsent = 0; 583 int eventsent = 0;
590 bhv_vrwlock_t locktype; 584 bhv_vrwlock_t locktype;
@@ -604,8 +598,7 @@ xfs_write(
604 if (count == 0) 598 if (count == 0)
605 return 0; 599 return 0;
606 600
607 io = &xip->i_iocore; 601 mp = xip->i_mount;
608 mp = io->io_mount;
609 602
610 xfs_wait_for_freeze(mp, SB_FREEZE_WRITE); 603 xfs_wait_for_freeze(mp, SB_FREEZE_WRITE);
611 604
@@ -685,7 +678,7 @@ start:
685 678
686 new_size = pos + count; 679 new_size = pos + count;
687 if (new_size > xip->i_size) 680 if (new_size > xip->i_size)
688 io->io_new_size = new_size; 681 xip->i_new_size = new_size;
689 682
690 if (likely(!(ioflags & IO_INVIS))) { 683 if (likely(!(ioflags & IO_INVIS))) {
691 file_update_time(file); 684 file_update_time(file);
@@ -737,7 +730,7 @@ retry:
737 if ((ioflags & IO_ISDIRECT)) { 730 if ((ioflags & IO_ISDIRECT)) {
738 if (VN_CACHED(vp)) { 731 if (VN_CACHED(vp)) {
739 WARN_ON(need_i_mutex == 0); 732 WARN_ON(need_i_mutex == 0);
740 xfs_inval_cached_trace(io, pos, -1, 733 xfs_inval_cached_trace(xip, pos, -1,
741 ctooff(offtoct(pos)), -1); 734 ctooff(offtoct(pos)), -1);
742 error = xfs_flushinval_pages(xip, 735 error = xfs_flushinval_pages(xip,
743 ctooff(offtoct(pos)), 736 ctooff(offtoct(pos)),
@@ -756,7 +749,7 @@ retry:
756 need_i_mutex = 0; 749 need_i_mutex = 0;
757 } 750 }
758 751
759 xfs_rw_enter_trace(XFS_DIOWR_ENTER, io, (void *)iovp, segs, 752 xfs_rw_enter_trace(XFS_DIOWR_ENTER, xip, (void *)iovp, segs,
760 *offset, ioflags); 753 *offset, ioflags);
761 ret = generic_file_direct_write(iocb, iovp, 754 ret = generic_file_direct_write(iocb, iovp,
762 &segs, pos, offset, count, ocount); 755 &segs, pos, offset, count, ocount);
@@ -776,7 +769,7 @@ retry:
776 goto relock; 769 goto relock;
777 } 770 }
778 } else { 771 } else {
779 xfs_rw_enter_trace(XFS_WRITE_ENTER, io, (void *)iovp, segs, 772 xfs_rw_enter_trace(XFS_WRITE_ENTER, xip, (void *)iovp, segs,
780 *offset, ioflags); 773 *offset, ioflags);
781 ret = generic_file_buffered_write(iocb, iovp, segs, 774 ret = generic_file_buffered_write(iocb, iovp, segs,
782 pos, offset, count, ret); 775 pos, offset, count, ret);
@@ -840,9 +833,9 @@ retry:
840 } 833 }
841 834
842 out_unlock_internal: 835 out_unlock_internal:
843 if (io->io_new_size) { 836 if (xip->i_new_size) {
844 xfs_ilock(xip, XFS_ILOCK_EXCL); 837 xfs_ilock(xip, XFS_ILOCK_EXCL);
845 io->io_new_size = 0; 838 xip->i_new_size = 0;
846 /* 839 /*
847 * If this was a direct or synchronous I/O that failed (such 840 * If this was a direct or synchronous I/O that failed (such
848 * as ENOSPC) then part of the I/O may have been written to 841 * as ENOSPC) then part of the I/O may have been written to
diff --git a/fs/xfs/linux-2.6/xfs_lrw.h b/fs/xfs/linux-2.6/xfs_lrw.h
index a982fbc6a7cf..e200253139cf 100644
--- a/fs/xfs/linux-2.6/xfs_lrw.h
+++ b/fs/xfs/linux-2.6/xfs_lrw.h
@@ -19,7 +19,6 @@
19#define __XFS_LRW_H__ 19#define __XFS_LRW_H__
20 20
21struct xfs_mount; 21struct xfs_mount;
22struct xfs_iocore;
23struct xfs_inode; 22struct xfs_inode;
24struct xfs_bmbt_irec; 23struct xfs_bmbt_irec;
25struct xfs_buf; 24struct xfs_buf;
@@ -60,13 +59,13 @@ struct xfs_iomap;
60#define XFS_IOMAP_UNWRITTEN 27 59#define XFS_IOMAP_UNWRITTEN 27
61#define XFS_SPLICE_READ_ENTER 28 60#define XFS_SPLICE_READ_ENTER 28
62#define XFS_SPLICE_WRITE_ENTER 29 61#define XFS_SPLICE_WRITE_ENTER 29
63extern void xfs_rw_enter_trace(int, struct xfs_iocore *, 62extern void xfs_rw_enter_trace(int, struct xfs_inode *,
64 void *, size_t, loff_t, int); 63 void *, size_t, loff_t, int);
65extern void xfs_inval_cached_trace(struct xfs_iocore *, 64extern void xfs_inval_cached_trace(struct xfs_inode *,
66 xfs_off_t, xfs_off_t, xfs_off_t, xfs_off_t); 65 xfs_off_t, xfs_off_t, xfs_off_t, xfs_off_t);
67#else 66#else
68#define xfs_rw_enter_trace(tag, io, data, size, offset, ioflags) 67#define xfs_rw_enter_trace(tag, ip, data, size, offset, ioflags)
69#define xfs_inval_cached_trace(io, offset, len, first, last) 68#define xfs_inval_cached_trace(ip, offset, len, first, last)
70#endif 69#endif
71 70
72extern int xfsbdstrat(struct xfs_mount *, struct xfs_buf *); 71extern int xfsbdstrat(struct xfs_mount *, struct xfs_buf *);
diff --git a/fs/xfs/xfs_dfrag.c b/fs/xfs/xfs_dfrag.c
index 39c4480bbb9f..4ad29cbb4233 100644
--- a/fs/xfs/xfs_dfrag.c
+++ b/fs/xfs/xfs_dfrag.c
@@ -199,7 +199,7 @@ xfs_swap_extents(
199 } 199 }
200 200
201 if (VN_CACHED(tvp) != 0) { 201 if (VN_CACHED(tvp) != 0) {
202 xfs_inval_cached_trace(&tip->i_iocore, 0, -1, 0, -1); 202 xfs_inval_cached_trace(tip, 0, -1, 0, -1);
203 error = xfs_flushinval_pages(tip, 0, -1, 203 error = xfs_flushinval_pages(tip, 0, -1,
204 FI_REMAPF_LOCKED); 204 FI_REMAPF_LOCKED);
205 if (error) 205 if (error)
diff --git a/fs/xfs/xfs_iget.c b/fs/xfs/xfs_iget.c
index f77bda1473b7..15dba2ef847f 100644
--- a/fs/xfs/xfs_iget.c
+++ b/fs/xfs/xfs_iget.c
@@ -199,12 +199,9 @@ again:
199 XFS_STATS_INC(xs_ig_found); 199 XFS_STATS_INC(xs_ig_found);
200 200
201finish_inode: 201finish_inode:
202 if (ip->i_d.di_mode == 0) { 202 if (ip->i_d.di_mode == 0 && !(flags & XFS_IGET_CREATE)) {
203 if (!(flags & XFS_IGET_CREATE)) { 203 xfs_put_perag(mp, pag);
204 xfs_put_perag(mp, pag); 204 return ENOENT;
205 return ENOENT;
206 }
207 xfs_iocore_inode_reinit(ip);
208 } 205 }
209 206
210 if (lock_flags != 0) 207 if (lock_flags != 0)
@@ -235,7 +232,6 @@ finish_inode:
235 xfs_itrace_exit_tag(ip, "xfs_iget.alloc"); 232 xfs_itrace_exit_tag(ip, "xfs_iget.alloc");
236 233
237 xfs_inode_lock_init(ip, vp); 234 xfs_inode_lock_init(ip, vp);
238 xfs_iocore_inode_init(ip);
239 if (lock_flags) 235 if (lock_flags)
240 xfs_ilock(ip, lock_flags); 236 xfs_ilock(ip, lock_flags);
241 237
@@ -331,9 +327,6 @@ finish_inode:
331 ASSERT(ip->i_df.if_ext_max == 327 ASSERT(ip->i_df.if_ext_max ==
332 XFS_IFORK_DSIZE(ip) / sizeof(xfs_bmbt_rec_t)); 328 XFS_IFORK_DSIZE(ip) / sizeof(xfs_bmbt_rec_t));
333 329
334 ASSERT(((ip->i_d.di_flags & XFS_DIFLAG_REALTIME) != 0) ==
335 ((ip->i_iocore.io_flags & XFS_IOCORE_RT) != 0));
336
337 xfs_iflags_set(ip, XFS_IMODIFIED); 330 xfs_iflags_set(ip, XFS_IMODIFIED);
338 *ipp = ip; 331 *ipp = ip;
339 332
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index e7930680fff4..6d5641ff08f6 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -1220,10 +1220,8 @@ xfs_ialloc(
1220 ip->i_d.di_extsize = pip->i_d.di_extsize; 1220 ip->i_d.di_extsize = pip->i_d.di_extsize;
1221 } 1221 }
1222 } else if ((mode & S_IFMT) == S_IFREG) { 1222 } else if ((mode & S_IFMT) == S_IFREG) {
1223 if (pip->i_d.di_flags & XFS_DIFLAG_RTINHERIT) { 1223 if (pip->i_d.di_flags & XFS_DIFLAG_RTINHERIT)
1224 di_flags |= XFS_DIFLAG_REALTIME; 1224 di_flags |= XFS_DIFLAG_REALTIME;
1225 ip->i_iocore.io_flags |= XFS_IOCORE_RT;
1226 }
1227 if (pip->i_d.di_flags & XFS_DIFLAG_EXTSZINHERIT) { 1225 if (pip->i_d.di_flags & XFS_DIFLAG_EXTSZINHERIT) {
1228 di_flags |= XFS_DIFLAG_EXTSIZE; 1226 di_flags |= XFS_DIFLAG_EXTSIZE;
1229 ip->i_d.di_extsize = pip->i_d.di_extsize; 1227 ip->i_d.di_extsize = pip->i_d.di_extsize;
diff --git a/fs/xfs/xfs_inode.h b/fs/xfs/xfs_inode.h
index c3e21ef02662..88caadde6077 100644
--- a/fs/xfs/xfs_inode.h
+++ b/fs/xfs/xfs_inode.h
@@ -132,45 +132,6 @@ typedef struct dm_attrs_s {
132 __uint16_t da_pad; /* DMIG extra padding */ 132 __uint16_t da_pad; /* DMIG extra padding */
133} dm_attrs_t; 133} dm_attrs_t;
134 134
135typedef struct xfs_iocore {
136 void *io_obj; /* pointer to container
137 * inode or dcxvn structure */
138 struct xfs_mount *io_mount; /* fs mount struct ptr */
139#ifdef DEBUG
140 mrlock_t *io_lock; /* inode IO lock */
141 mrlock_t *io_iolock; /* inode IO lock */
142#endif
143
144 /* I/O state */
145 xfs_fsize_t io_new_size; /* sz when write completes */
146
147 /* Miscellaneous state. */
148 unsigned int io_flags; /* IO related flags */
149
150 /* DMAPI state */
151 dm_attrs_t io_dmattrs;
152
153} xfs_iocore_t;
154
155#define io_dmevmask io_dmattrs.da_dmevmask
156#define io_dmstate io_dmattrs.da_dmstate
157
158#define XFS_IO_INODE(io) ((xfs_inode_t *) ((io)->io_obj))
159#define XFS_IO_DCXVN(io) ((dcxvn_t *) ((io)->io_obj))
160
161/*
162 * Flags in the flags field
163 */
164
165#define XFS_IOCORE_RT 0x1
166
167/*
168 * xfs_iocore prototypes
169 */
170
171extern void xfs_iocore_inode_init(struct xfs_inode *);
172extern void xfs_iocore_inode_reinit(struct xfs_inode *);
173
174/* 135/*
175 * This is the xfs inode cluster structure. This structure is used by 136 * This is the xfs inode cluster structure. This structure is used by
176 * xfs_iflush to find inodes that share a cluster and can be flushed to disk at 137 * xfs_iflush to find inodes that share a cluster and can be flushed to disk at
@@ -283,9 +244,6 @@ typedef struct xfs_inode {
283 struct xfs_inode **i_refcache; /* ptr to entry in ref cache */ 244 struct xfs_inode **i_refcache; /* ptr to entry in ref cache */
284 struct xfs_inode *i_release; /* inode to unref */ 245 struct xfs_inode *i_release; /* inode to unref */
285#endif 246#endif
286 /* I/O state */
287 xfs_iocore_t i_iocore; /* I/O core */
288
289 /* Miscellaneous state. */ 247 /* Miscellaneous state. */
290 unsigned short i_flags; /* see defined flags below */ 248 unsigned short i_flags; /* see defined flags below */
291 unsigned char i_update_core; /* timestamps/size is dirty */ 249 unsigned char i_update_core; /* timestamps/size is dirty */
@@ -298,6 +256,7 @@ typedef struct xfs_inode {
298 struct hlist_node i_cnode; /* cluster link node */ 256 struct hlist_node i_cnode; /* cluster link node */
299 257
300 xfs_fsize_t i_size; /* in-memory size */ 258 xfs_fsize_t i_size; /* in-memory size */
259 xfs_fsize_t i_new_size; /* size when write completes */
301 atomic_t i_iocount; /* outstanding I/O count */ 260 atomic_t i_iocount; /* outstanding I/O count */
302 /* Trace buffers per inode. */ 261 /* Trace buffers per inode. */
303#ifdef XFS_INODE_TRACE 262#ifdef XFS_INODE_TRACE
diff --git a/fs/xfs/xfs_iocore.c b/fs/xfs/xfs_iocore.c
deleted file mode 100644
index 336e27b39e13..000000000000
--- a/fs/xfs/xfs_iocore.c
+++ /dev/null
@@ -1,79 +0,0 @@
1/*
2 * Copyright (c) 2000-2003,2005 Silicon Graphics, Inc.
3 * All Rights Reserved.
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it would be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write the Free Software Foundation,
16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18#include "xfs.h"
19#include "xfs_fs.h"
20#include "xfs_types.h"
21#include "xfs_bit.h"
22#include "xfs_log.h"
23#include "xfs_inum.h"
24#include "xfs_trans.h"
25#include "xfs_sb.h"
26#include "xfs_ag.h"
27#include "xfs_dir2.h"
28#include "xfs_dfrag.h"
29#include "xfs_dmapi.h"
30#include "xfs_mount.h"
31#include "xfs_bmap_btree.h"
32#include "xfs_alloc_btree.h"
33#include "xfs_ialloc_btree.h"
34#include "xfs_dir2_sf.h"
35#include "xfs_attr_sf.h"
36#include "xfs_dinode.h"
37#include "xfs_inode.h"
38#include "xfs_inode_item.h"
39#include "xfs_itable.h"
40#include "xfs_btree.h"
41#include "xfs_alloc.h"
42#include "xfs_ialloc.h"
43#include "xfs_bmap.h"
44#include "xfs_error.h"
45#include "xfs_rw.h"
46#include "xfs_quota.h"
47#include "xfs_trans_space.h"
48#include "xfs_iomap.h"
49
50void
51xfs_iocore_inode_reinit(
52 xfs_inode_t *ip)
53{
54 xfs_iocore_t *io = &ip->i_iocore;
55
56 io->io_flags = 0;
57 if (ip->i_d.di_flags & XFS_DIFLAG_REALTIME)
58 io->io_flags |= XFS_IOCORE_RT;
59 io->io_dmevmask = ip->i_d.di_dmevmask;
60 io->io_dmstate = ip->i_d.di_dmstate;
61}
62
63void
64xfs_iocore_inode_init(
65 xfs_inode_t *ip)
66{
67 xfs_iocore_t *io = &ip->i_iocore;
68 xfs_mount_t *mp = ip->i_mount;
69
70 io->io_mount = mp;
71#ifdef DEBUG
72 io->io_lock = &ip->i_lock;
73 io->io_iolock = &ip->i_iolock;
74#endif
75
76 io->io_obj = (void *)ip;
77
78 xfs_iocore_inode_reinit(ip);
79}
diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c
index 4821b8563c41..d16f40cdf5f6 100644
--- a/fs/xfs/xfs_iomap.c
+++ b/fs/xfs/xfs_iomap.c
@@ -57,8 +57,6 @@ xfs_iomap_enter_trace(
57 xfs_off_t offset, 57 xfs_off_t offset,
58 ssize_t count) 58 ssize_t count)
59{ 59{
60 xfs_iocore_t *io = &ip->i_iocore;
61
62 if (!ip->i_rwtrace) 60 if (!ip->i_rwtrace)
63 return; 61 return;
64 62
@@ -70,8 +68,8 @@ xfs_iomap_enter_trace(
70 (void *)((unsigned long)((offset >> 32) & 0xffffffff)), 68 (void *)((unsigned long)((offset >> 32) & 0xffffffff)),
71 (void *)((unsigned long)(offset & 0xffffffff)), 69 (void *)((unsigned long)(offset & 0xffffffff)),
72 (void *)((unsigned long)count), 70 (void *)((unsigned long)count),
73 (void *)((unsigned long)((io->io_new_size >> 32) & 0xffffffff)), 71 (void *)((unsigned long)((ip->i_new_size >> 32) & 0xffffffff)),
74 (void *)((unsigned long)(io->io_new_size & 0xffffffff)), 72 (void *)((unsigned long)(ip->i_new_size & 0xffffffff)),
75 (void *)((unsigned long)current_pid()), 73 (void *)((unsigned long)current_pid()),
76 (void *)NULL, 74 (void *)NULL,
77 (void *)NULL, 75 (void *)NULL,
@@ -186,8 +184,6 @@ xfs_iomap(
186 int iomap_flags = 0; 184 int iomap_flags = 0;
187 185
188 ASSERT((ip->i_d.di_mode & S_IFMT) == S_IFREG); 186 ASSERT((ip->i_d.di_mode & S_IFMT) == S_IFREG);
189 ASSERT(((ip->i_d.di_flags & XFS_DIFLAG_REALTIME) != 0) ==
190 ((ip->i_iocore.io_flags & XFS_IOCORE_RT) != 0));
191 187
192 if (XFS_FORCED_SHUTDOWN(mp)) 188 if (XFS_FORCED_SHUTDOWN(mp))
193 return XFS_ERROR(EIO); 189 return XFS_ERROR(EIO);
@@ -402,7 +398,6 @@ xfs_iomap_write_direct(
402 int found) 398 int found)
403{ 399{
404 xfs_mount_t *mp = ip->i_mount; 400 xfs_mount_t *mp = ip->i_mount;
405 xfs_iocore_t *io = &ip->i_iocore;
406 xfs_fileoff_t offset_fsb; 401 xfs_fileoff_t offset_fsb;
407 xfs_fileoff_t last_fsb; 402 xfs_fileoff_t last_fsb;
408 xfs_filblks_t count_fsb, resaligned; 403 xfs_filblks_t count_fsb, resaligned;
@@ -432,8 +427,8 @@ xfs_iomap_write_direct(
432 extsz = xfs_get_extsz_hint(ip); 427 extsz = xfs_get_extsz_hint(ip);
433 428
434 isize = ip->i_size; 429 isize = ip->i_size;
435 if (io->io_new_size > isize) 430 if (ip->i_new_size > isize)
436 isize = io->io_new_size; 431 isize = ip->i_new_size;
437 432
438 offset_fsb = XFS_B_TO_FSBT(mp, offset); 433 offset_fsb = XFS_B_TO_FSBT(mp, offset);
439 last_fsb = XFS_B_TO_FSB(mp, ((xfs_ufsize_t)(offset + count))); 434 last_fsb = XFS_B_TO_FSB(mp, ((xfs_ufsize_t)(offset + count)));
@@ -528,7 +523,8 @@ xfs_iomap_write_direct(
528 goto error_out; 523 goto error_out;
529 } 524 }
530 525
531 if (unlikely(!imap.br_startblock && !(io->io_flags & XFS_IOCORE_RT))) { 526 if (unlikely(!imap.br_startblock &&
527 !(ip->i_d.di_flags & XFS_DIFLAG_REALTIME))) {
532 error = xfs_cmn_err_fsblock_zero(ip, &imap); 528 error = xfs_cmn_err_fsblock_zero(ip, &imap);
533 goto error_out; 529 goto error_out;
534 } 530 }
@@ -616,7 +612,6 @@ xfs_iomap_write_delay(
616 int *nmaps) 612 int *nmaps)
617{ 613{
618 xfs_mount_t *mp = ip->i_mount; 614 xfs_mount_t *mp = ip->i_mount;
619 xfs_iocore_t *io = &ip->i_iocore;
620 xfs_fileoff_t offset_fsb; 615 xfs_fileoff_t offset_fsb;
621 xfs_fileoff_t last_fsb; 616 xfs_fileoff_t last_fsb;
622 xfs_off_t aligned_offset; 617 xfs_off_t aligned_offset;
@@ -644,8 +639,8 @@ xfs_iomap_write_delay(
644 639
645retry: 640retry:
646 isize = ip->i_size; 641 isize = ip->i_size;
647 if (io->io_new_size > isize) 642 if (ip->i_new_size > isize)
648 isize = io->io_new_size; 643 isize = ip->i_new_size;
649 644
650 error = xfs_iomap_eof_want_preallocate(mp, ip, isize, offset, count, 645 error = xfs_iomap_eof_want_preallocate(mp, ip, isize, offset, count,
651 ioflag, imap, XFS_WRITE_IMAPS, &prealloc); 646 ioflag, imap, XFS_WRITE_IMAPS, &prealloc);
@@ -691,7 +686,8 @@ retry:
691 goto retry; 686 goto retry;
692 } 687 }
693 688
694 if (unlikely(!imap[0].br_startblock && !(io->io_flags & XFS_IOCORE_RT))) 689 if (unlikely(!imap[0].br_startblock &&
690 !(ip->i_d.di_flags & XFS_DIFLAG_REALTIME)))
695 return xfs_cmn_err_fsblock_zero(ip, &imap[0]); 691 return xfs_cmn_err_fsblock_zero(ip, &imap[0]);
696 692
697 *ret_imap = imap[0]; 693 *ret_imap = imap[0];
@@ -716,7 +712,6 @@ xfs_iomap_write_allocate(
716 int *retmap) 712 int *retmap)
717{ 713{
718 xfs_mount_t *mp = ip->i_mount; 714 xfs_mount_t *mp = ip->i_mount;
719 xfs_iocore_t *io = &ip->i_iocore;
720 xfs_fileoff_t offset_fsb, last_block; 715 xfs_fileoff_t offset_fsb, last_block;
721 xfs_fileoff_t end_fsb, map_start_fsb; 716 xfs_fileoff_t end_fsb, map_start_fsb;
722 xfs_fsblock_t first_block; 717 xfs_fsblock_t first_block;
@@ -814,7 +809,7 @@ xfs_iomap_write_allocate(
814 */ 809 */
815 for (i = 0; i < nimaps; i++) { 810 for (i = 0; i < nimaps; i++) {
816 if (unlikely(!imap[i].br_startblock && 811 if (unlikely(!imap[i].br_startblock &&
817 !(io->io_flags & XFS_IOCORE_RT))) 812 !(ip->i_d.di_flags & XFS_DIFLAG_REALTIME)))
818 return xfs_cmn_err_fsblock_zero(ip, &imap[i]); 813 return xfs_cmn_err_fsblock_zero(ip, &imap[i]);
819 if ((offset_fsb >= imap[i].br_startoff) && 814 if ((offset_fsb >= imap[i].br_startoff) &&
820 (offset_fsb < (imap[i].br_startoff + 815 (offset_fsb < (imap[i].br_startoff +
@@ -850,7 +845,6 @@ xfs_iomap_write_unwritten(
850 size_t count) 845 size_t count)
851{ 846{
852 xfs_mount_t *mp = ip->i_mount; 847 xfs_mount_t *mp = ip->i_mount;
853 xfs_iocore_t *io = &ip->i_iocore;
854 xfs_fileoff_t offset_fsb; 848 xfs_fileoff_t offset_fsb;
855 xfs_filblks_t count_fsb; 849 xfs_filblks_t count_fsb;
856 xfs_filblks_t numblks_fsb; 850 xfs_filblks_t numblks_fsb;
@@ -913,7 +907,7 @@ xfs_iomap_write_unwritten(
913 return XFS_ERROR(error); 907 return XFS_ERROR(error);
914 908
915 if (unlikely(!imap.br_startblock && 909 if (unlikely(!imap.br_startblock &&
916 !(io->io_flags & XFS_IOCORE_RT))) 910 !(ip->i_d.di_flags & XFS_DIFLAG_REALTIME)))
917 return xfs_cmn_err_fsblock_zero(ip, &imap); 911 return xfs_cmn_err_fsblock_zero(ip, &imap);
918 912
919 if ((numblks_fsb = imap.br_blockcount) == 0) { 913 if ((numblks_fsb = imap.br_blockcount) == 0) {
diff --git a/fs/xfs/xfs_mount.h b/fs/xfs/xfs_mount.h
index 169d993c0b72..15025e01300a 100644
--- a/fs/xfs/xfs_mount.h
+++ b/fs/xfs/xfs_mount.h
@@ -56,7 +56,6 @@ struct cred;
56struct log; 56struct log;
57struct xfs_mount_args; 57struct xfs_mount_args;
58struct xfs_inode; 58struct xfs_inode;
59struct xfs_iocore;
60struct xfs_bmbt_irec; 59struct xfs_bmbt_irec;
61struct xfs_bmap_free; 60struct xfs_bmap_free;
62struct xfs_extdelta; 61struct xfs_extdelta;
diff --git a/fs/xfs/xfs_rw.h b/fs/xfs/xfs_rw.h
index 49875e1d129f..bcfe07aa7e6b 100644
--- a/fs/xfs/xfs_rw.h
+++ b/fs/xfs/xfs_rw.h
@@ -36,14 +36,6 @@ xfs_fsb_to_db(struct xfs_inode *ip, xfs_fsblock_t fsb)
36 (xfs_daddr_t)XFS_FSB_TO_BB((ip)->i_mount, (fsb)) : \ 36 (xfs_daddr_t)XFS_FSB_TO_BB((ip)->i_mount, (fsb)) : \
37 XFS_FSB_TO_DADDR((ip)->i_mount, (fsb))); 37 XFS_FSB_TO_DADDR((ip)->i_mount, (fsb)));
38} 38}
39#define XFS_FSB_TO_DB_IO(io,fsb) xfs_fsb_to_db_io(io,fsb)
40static inline xfs_daddr_t
41xfs_fsb_to_db_io(struct xfs_iocore *io, xfs_fsblock_t fsb)
42{
43 return (((io)->io_flags & XFS_IOCORE_RT) ? \
44 XFS_FSB_TO_BB((io)->io_mount, (fsb)) : \
45 XFS_FSB_TO_DADDR((io)->io_mount, (fsb)));
46}
47 39
48/* 40/*
49 * Flags for xfs_free_eofblocks 41 * Flags for xfs_free_eofblocks
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c
index 7d3c4a7aa2dc..d964e21521ab 100644
--- a/fs/xfs/xfs_vnodeops.c
+++ b/fs/xfs/xfs_vnodeops.c
@@ -804,12 +804,8 @@ xfs_setattr(
804 if (vap->va_xflags & XFS_XFLAG_EXTSZINHERIT) 804 if (vap->va_xflags & XFS_XFLAG_EXTSZINHERIT)
805 di_flags |= XFS_DIFLAG_EXTSZINHERIT; 805 di_flags |= XFS_DIFLAG_EXTSZINHERIT;
806 } else if ((ip->i_d.di_mode & S_IFMT) == S_IFREG) { 806 } else if ((ip->i_d.di_mode & S_IFMT) == S_IFREG) {
807 if (vap->va_xflags & XFS_XFLAG_REALTIME) { 807 if (vap->va_xflags & XFS_XFLAG_REALTIME)
808 di_flags |= XFS_DIFLAG_REALTIME; 808 di_flags |= XFS_DIFLAG_REALTIME;
809 ip->i_iocore.io_flags |= XFS_IOCORE_RT;
810 } else {
811 ip->i_iocore.io_flags &= ~XFS_IOCORE_RT;
812 }
813 if (vap->va_xflags & XFS_XFLAG_EXTSIZE) 809 if (vap->va_xflags & XFS_XFLAG_EXTSIZE)
814 di_flags |= XFS_DIFLAG_EXTSIZE; 810 di_flags |= XFS_DIFLAG_EXTSIZE;
815 } 811 }
@@ -3633,8 +3629,8 @@ xfs_set_dmattrs(
3633 xfs_ilock(ip, XFS_ILOCK_EXCL); 3629 xfs_ilock(ip, XFS_ILOCK_EXCL);
3634 xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL); 3630 xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL);
3635 3631
3636 ip->i_iocore.io_dmevmask = ip->i_d.di_dmevmask = evmask; 3632 ip->i_d.di_dmevmask = evmask;
3637 ip->i_iocore.io_dmstate = ip->i_d.di_dmstate = state; 3633 ip->i_d.di_dmstate = state;
3638 3634
3639 xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); 3635 xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
3640 IHOLD(ip); 3636 IHOLD(ip);
@@ -4172,7 +4168,7 @@ xfs_free_file_space(
4172 ioffset = offset & ~(rounding - 1); 4168 ioffset = offset & ~(rounding - 1);
4173 4169
4174 if (VN_CACHED(vp) != 0) { 4170 if (VN_CACHED(vp) != 0) {
4175 xfs_inval_cached_trace(&ip->i_iocore, ioffset, -1, 4171 xfs_inval_cached_trace(ip, ioffset, -1,
4176 ctooff(offtoct(ioffset)), -1); 4172 ctooff(offtoct(ioffset)), -1);
4177 error = xfs_flushinval_pages(ip, 4173 error = xfs_flushinval_pages(ip,
4178 ctooff(offtoct(ioffset)), 4174 ctooff(offtoct(ioffset)),