diff options
Diffstat (limited to 'fs/xfs/xfs_iomap.c')
-rw-r--r-- | fs/xfs/xfs_iomap.c | 85 |
1 files changed, 8 insertions, 77 deletions
diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c index 7294abce6ef2..0b65039951a0 100644 --- a/fs/xfs/xfs_iomap.c +++ b/fs/xfs/xfs_iomap.c | |||
@@ -47,72 +47,8 @@ | |||
47 | #include "xfs_trans_space.h" | 47 | #include "xfs_trans_space.h" |
48 | #include "xfs_utils.h" | 48 | #include "xfs_utils.h" |
49 | #include "xfs_iomap.h" | 49 | #include "xfs_iomap.h" |
50 | #include "xfs_trace.h" | ||
50 | 51 | ||
51 | #if defined(XFS_RW_TRACE) | ||
52 | void | ||
53 | xfs_iomap_enter_trace( | ||
54 | int tag, | ||
55 | xfs_inode_t *ip, | ||
56 | xfs_off_t offset, | ||
57 | ssize_t count) | ||
58 | { | ||
59 | if (!ip->i_rwtrace) | ||
60 | return; | ||
61 | |||
62 | ktrace_enter(ip->i_rwtrace, | ||
63 | (void *)((unsigned long)tag), | ||
64 | (void *)ip, | ||
65 | (void *)((unsigned long)((ip->i_d.di_size >> 32) & 0xffffffff)), | ||
66 | (void *)((unsigned long)(ip->i_d.di_size & 0xffffffff)), | ||
67 | (void *)((unsigned long)((offset >> 32) & 0xffffffff)), | ||
68 | (void *)((unsigned long)(offset & 0xffffffff)), | ||
69 | (void *)((unsigned long)count), | ||
70 | (void *)((unsigned long)((ip->i_new_size >> 32) & 0xffffffff)), | ||
71 | (void *)((unsigned long)(ip->i_new_size & 0xffffffff)), | ||
72 | (void *)((unsigned long)current_pid()), | ||
73 | (void *)NULL, | ||
74 | (void *)NULL, | ||
75 | (void *)NULL, | ||
76 | (void *)NULL, | ||
77 | (void *)NULL, | ||
78 | (void *)NULL); | ||
79 | } | ||
80 | |||
81 | void | ||
82 | xfs_iomap_map_trace( | ||
83 | int tag, | ||
84 | xfs_inode_t *ip, | ||
85 | xfs_off_t offset, | ||
86 | ssize_t count, | ||
87 | xfs_iomap_t *iomapp, | ||
88 | xfs_bmbt_irec_t *imapp, | ||
89 | int flags) | ||
90 | { | ||
91 | if (!ip->i_rwtrace) | ||
92 | return; | ||
93 | |||
94 | ktrace_enter(ip->i_rwtrace, | ||
95 | (void *)((unsigned long)tag), | ||
96 | (void *)ip, | ||
97 | (void *)((unsigned long)((ip->i_d.di_size >> 32) & 0xffffffff)), | ||
98 | (void *)((unsigned long)(ip->i_d.di_size & 0xffffffff)), | ||
99 | (void *)((unsigned long)((offset >> 32) & 0xffffffff)), | ||
100 | (void *)((unsigned long)(offset & 0xffffffff)), | ||
101 | (void *)((unsigned long)count), | ||
102 | (void *)((unsigned long)flags), | ||
103 | (void *)((unsigned long)((iomapp->iomap_offset >> 32) & 0xffffffff)), | ||
104 | (void *)((unsigned long)(iomapp->iomap_offset & 0xffffffff)), | ||
105 | (void *)((unsigned long)(iomapp->iomap_delta)), | ||
106 | (void *)((unsigned long)(iomapp->iomap_bsize)), | ||
107 | (void *)((unsigned long)(iomapp->iomap_bn)), | ||
108 | (void *)(__psint_t)(imapp->br_startoff), | ||
109 | (void *)((unsigned long)(imapp->br_blockcount)), | ||
110 | (void *)(__psint_t)(imapp->br_startblock)); | ||
111 | } | ||
112 | #else | ||
113 | #define xfs_iomap_enter_trace(tag, io, offset, count) | ||
114 | #define xfs_iomap_map_trace(tag, io, offset, count, iomapp, imapp, flags) | ||
115 | #endif | ||
116 | 52 | ||
117 | #define XFS_WRITEIO_ALIGN(mp,off) (((off) >> mp->m_writeio_log) \ | 53 | #define XFS_WRITEIO_ALIGN(mp,off) (((off) >> mp->m_writeio_log) \ |
118 | << mp->m_writeio_log) | 54 | << mp->m_writeio_log) |
@@ -187,21 +123,20 @@ xfs_iomap( | |||
187 | if (XFS_FORCED_SHUTDOWN(mp)) | 123 | if (XFS_FORCED_SHUTDOWN(mp)) |
188 | return XFS_ERROR(EIO); | 124 | return XFS_ERROR(EIO); |
189 | 125 | ||
126 | trace_xfs_iomap_enter(ip, offset, count, flags, NULL); | ||
127 | |||
190 | switch (flags & (BMAPI_READ | BMAPI_WRITE | BMAPI_ALLOCATE)) { | 128 | switch (flags & (BMAPI_READ | BMAPI_WRITE | BMAPI_ALLOCATE)) { |
191 | case BMAPI_READ: | 129 | case BMAPI_READ: |
192 | xfs_iomap_enter_trace(XFS_IOMAP_READ_ENTER, ip, offset, count); | ||
193 | lockmode = xfs_ilock_map_shared(ip); | 130 | lockmode = xfs_ilock_map_shared(ip); |
194 | bmapi_flags = XFS_BMAPI_ENTIRE; | 131 | bmapi_flags = XFS_BMAPI_ENTIRE; |
195 | break; | 132 | break; |
196 | case BMAPI_WRITE: | 133 | case BMAPI_WRITE: |
197 | xfs_iomap_enter_trace(XFS_IOMAP_WRITE_ENTER, ip, offset, count); | ||
198 | lockmode = XFS_ILOCK_EXCL; | 134 | lockmode = XFS_ILOCK_EXCL; |
199 | if (flags & BMAPI_IGNSTATE) | 135 | if (flags & BMAPI_IGNSTATE) |
200 | bmapi_flags |= XFS_BMAPI_IGSTATE|XFS_BMAPI_ENTIRE; | 136 | bmapi_flags |= XFS_BMAPI_IGSTATE|XFS_BMAPI_ENTIRE; |
201 | xfs_ilock(ip, lockmode); | 137 | xfs_ilock(ip, lockmode); |
202 | break; | 138 | break; |
203 | case BMAPI_ALLOCATE: | 139 | case BMAPI_ALLOCATE: |
204 | xfs_iomap_enter_trace(XFS_IOMAP_ALLOC_ENTER, ip, offset, count); | ||
205 | lockmode = XFS_ILOCK_SHARED; | 140 | lockmode = XFS_ILOCK_SHARED; |
206 | bmapi_flags = XFS_BMAPI_ENTIRE; | 141 | bmapi_flags = XFS_BMAPI_ENTIRE; |
207 | 142 | ||
@@ -237,8 +172,7 @@ xfs_iomap( | |||
237 | if (nimaps && | 172 | if (nimaps && |
238 | (imap.br_startblock != HOLESTARTBLOCK) && | 173 | (imap.br_startblock != HOLESTARTBLOCK) && |
239 | (imap.br_startblock != DELAYSTARTBLOCK)) { | 174 | (imap.br_startblock != DELAYSTARTBLOCK)) { |
240 | xfs_iomap_map_trace(XFS_IOMAP_WRITE_MAP, ip, | 175 | trace_xfs_iomap_found(ip, offset, count, flags, &imap); |
241 | offset, count, iomapp, &imap, flags); | ||
242 | break; | 176 | break; |
243 | } | 177 | } |
244 | 178 | ||
@@ -250,8 +184,7 @@ xfs_iomap( | |||
250 | &imap, &nimaps); | 184 | &imap, &nimaps); |
251 | } | 185 | } |
252 | if (!error) { | 186 | if (!error) { |
253 | xfs_iomap_map_trace(XFS_IOMAP_ALLOC_MAP, ip, | 187 | trace_xfs_iomap_alloc(ip, offset, count, flags, &imap); |
254 | offset, count, iomapp, &imap, flags); | ||
255 | } | 188 | } |
256 | iomap_flags = IOMAP_NEW; | 189 | iomap_flags = IOMAP_NEW; |
257 | break; | 190 | break; |
@@ -261,8 +194,7 @@ xfs_iomap( | |||
261 | lockmode = 0; | 194 | lockmode = 0; |
262 | 195 | ||
263 | if (nimaps && !isnullstartblock(imap.br_startblock)) { | 196 | if (nimaps && !isnullstartblock(imap.br_startblock)) { |
264 | xfs_iomap_map_trace(XFS_IOMAP_WRITE_MAP, ip, | 197 | trace_xfs_iomap_found(ip, offset, count, flags, &imap); |
265 | offset, count, iomapp, &imap, flags); | ||
266 | break; | 198 | break; |
267 | } | 199 | } |
268 | 200 | ||
@@ -623,8 +555,7 @@ retry: | |||
623 | * delalloc blocks and retry without EOF preallocation. | 555 | * delalloc blocks and retry without EOF preallocation. |
624 | */ | 556 | */ |
625 | if (nimaps == 0) { | 557 | if (nimaps == 0) { |
626 | xfs_iomap_enter_trace(XFS_IOMAP_WRITE_NOSPACE, | 558 | trace_xfs_delalloc_enospc(ip, offset, count); |
627 | ip, offset, count); | ||
628 | if (flushed) | 559 | if (flushed) |
629 | return XFS_ERROR(ENOSPC); | 560 | return XFS_ERROR(ENOSPC); |
630 | 561 | ||
@@ -837,7 +768,7 @@ xfs_iomap_write_unwritten( | |||
837 | int committed; | 768 | int committed; |
838 | int error; | 769 | int error; |
839 | 770 | ||
840 | xfs_iomap_enter_trace(XFS_IOMAP_UNWRITTEN, ip, offset, count); | 771 | trace_xfs_unwritten_convert(ip, offset, count); |
841 | 772 | ||
842 | offset_fsb = XFS_B_TO_FSBT(mp, offset); | 773 | offset_fsb = XFS_B_TO_FSBT(mp, offset); |
843 | count_fsb = XFS_B_TO_FSB(mp, (xfs_ufsize_t)offset + count); | 774 | count_fsb = XFS_B_TO_FSB(mp, (xfs_ufsize_t)offset + count); |