diff options
author | Dean Roehrich <roehrich@sgi.com> | 2005-06-21 20:20:44 -0400 |
---|---|---|
committer | Nathan Scott <nathans@sgi.com> | 2005-06-21 20:20:44 -0400 |
commit | e1a40fa907498030b6e432c0dbcb06d7a9f14ee3 (patch) | |
tree | 8f6ad8643346358ef39d7d28d1e001af81eb6e9a | |
parent | ad89d0212e32c5cf27dfcbad67b91a32b9878529 (diff) |
[XFS] Handle inode semaphores properly for dmapi queues
SGI-PV: 931572
SGI-Modid: xfs-linux-melb:xfs-kern:189560a
Signed-off-by: Dean Roehrich <roehrich@sgi.com>
Signed-off-by: Nathan Scott <nathans@sgi.com>
-rw-r--r-- | fs/xfs/linux-2.6/xfs_lrw.c | 10 | ||||
-rw-r--r-- | fs/xfs/xfs_dmapi.h | 23 |
2 files changed, 20 insertions, 13 deletions
diff --git a/fs/xfs/linux-2.6/xfs_lrw.c b/fs/xfs/linux-2.6/xfs_lrw.c index 46b61a859af4..acab58c48043 100644 --- a/fs/xfs/linux-2.6/xfs_lrw.c +++ b/fs/xfs/linux-2.6/xfs_lrw.c | |||
@@ -280,10 +280,11 @@ xfs_read( | |||
280 | if (DM_EVENT_ENABLED(vp->v_vfsp, ip, DM_EVENT_READ) && | 280 | if (DM_EVENT_ENABLED(vp->v_vfsp, ip, DM_EVENT_READ) && |
281 | !(ioflags & IO_INVIS)) { | 281 | !(ioflags & IO_INVIS)) { |
282 | vrwlock_t locktype = VRWLOCK_READ; | 282 | vrwlock_t locktype = VRWLOCK_READ; |
283 | int dmflags = FILP_DELAY_FLAG(file) | DM_SEM_FLAG_RD(ioflags); | ||
283 | 284 | ||
284 | ret = -XFS_SEND_DATA(mp, DM_EVENT_READ, | 285 | ret = -XFS_SEND_DATA(mp, DM_EVENT_READ, |
285 | BHV_TO_VNODE(bdp), *offset, size, | 286 | BHV_TO_VNODE(bdp), *offset, size, |
286 | FILP_DELAY_FLAG(file), &locktype); | 287 | dmflags, &locktype); |
287 | if (ret) { | 288 | if (ret) { |
288 | xfs_iunlock(ip, XFS_IOLOCK_SHARED); | 289 | xfs_iunlock(ip, XFS_IOLOCK_SHARED); |
289 | goto unlock_isem; | 290 | goto unlock_isem; |
@@ -843,11 +844,15 @@ retry: | |||
843 | !(ioflags & IO_INVIS)) { | 844 | !(ioflags & IO_INVIS)) { |
844 | 845 | ||
845 | xfs_rwunlock(bdp, locktype); | 846 | xfs_rwunlock(bdp, locktype); |
847 | if (need_isem) | ||
848 | up(&inode->i_sem); | ||
846 | error = XFS_SEND_NAMESP(xip->i_mount, DM_EVENT_NOSPACE, vp, | 849 | error = XFS_SEND_NAMESP(xip->i_mount, DM_EVENT_NOSPACE, vp, |
847 | DM_RIGHT_NULL, vp, DM_RIGHT_NULL, NULL, NULL, | 850 | DM_RIGHT_NULL, vp, DM_RIGHT_NULL, NULL, NULL, |
848 | 0, 0, 0); /* Delay flag intentionally unused */ | 851 | 0, 0, 0); /* Delay flag intentionally unused */ |
849 | if (error) | 852 | if (error) |
850 | goto out_unlock_isem; | 853 | goto out_nounlocks; |
854 | if (need_isem) | ||
855 | down(&inode->i_sem); | ||
851 | xfs_rwlock(bdp, locktype); | 856 | xfs_rwlock(bdp, locktype); |
852 | pos = xip->i_d.di_size; | 857 | pos = xip->i_d.di_size; |
853 | ret = 0; | 858 | ret = 0; |
@@ -962,6 +967,7 @@ retry: | |||
962 | out_unlock_isem: | 967 | out_unlock_isem: |
963 | if (need_isem) | 968 | if (need_isem) |
964 | up(&inode->i_sem); | 969 | up(&inode->i_sem); |
970 | out_nounlocks: | ||
965 | return -error; | 971 | return -error; |
966 | } | 972 | } |
967 | 973 | ||
diff --git a/fs/xfs/xfs_dmapi.h b/fs/xfs/xfs_dmapi.h index 16cf9f7a4785..55c17adaaa37 100644 --- a/fs/xfs/xfs_dmapi.h +++ b/fs/xfs/xfs_dmapi.h | |||
@@ -166,27 +166,32 @@ typedef enum { | |||
166 | #define DM_FLAGS_NDELAY 0x001 /* return EAGAIN after dm_pending() */ | 166 | #define DM_FLAGS_NDELAY 0x001 /* return EAGAIN after dm_pending() */ |
167 | #define DM_FLAGS_UNWANTED 0x002 /* event not in fsys dm_eventset_t */ | 167 | #define DM_FLAGS_UNWANTED 0x002 /* event not in fsys dm_eventset_t */ |
168 | #define DM_FLAGS_ISEM 0x004 /* thread holds i_sem */ | 168 | #define DM_FLAGS_ISEM 0x004 /* thread holds i_sem */ |
169 | #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) | ||
170 | #if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,21) | ||
171 | /* i_alloc_sem was added in 2.4.22-pre1 */ | ||
172 | #define DM_FLAGS_IALLOCSEM_RD 0x010 /* thread holds i_alloc_sem rd */ | 169 | #define DM_FLAGS_IALLOCSEM_RD 0x010 /* thread holds i_alloc_sem rd */ |
173 | #define DM_FLAGS_IALLOCSEM_WR 0x020 /* thread holds i_alloc_sem wr */ | 170 | #define DM_FLAGS_IALLOCSEM_WR 0x020 /* thread holds i_alloc_sem wr */ |
174 | #endif | ||
175 | #endif | ||
176 | 171 | ||
177 | /* | 172 | /* |
178 | * Based on IO_ISDIRECT, decide which i_ flag is set. | 173 | * Based on IO_ISDIRECT, decide which i_ flag is set. |
179 | */ | 174 | */ |
180 | #ifdef DM_FLAGS_IALLOCSEM_RD | 175 | #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) |
176 | #define DM_SEM_FLAG_RD(ioflags) (((ioflags) & IO_ISDIRECT) ? \ | ||
177 | DM_FLAGS_ISEM : 0) | ||
178 | #define DM_SEM_FLAG_WR (DM_FLAGS_IALLOCSEM_WR | DM_FLAGS_ISEM) | ||
179 | #endif | ||
180 | |||
181 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)) && \ | ||
182 | (LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,22)) | ||
181 | #define DM_SEM_FLAG_RD(ioflags) (((ioflags) & IO_ISDIRECT) ? \ | 183 | #define DM_SEM_FLAG_RD(ioflags) (((ioflags) & IO_ISDIRECT) ? \ |
182 | DM_FLAGS_IALLOCSEM_RD : DM_FLAGS_ISEM) | 184 | DM_FLAGS_IALLOCSEM_RD : DM_FLAGS_ISEM) |
183 | #define DM_SEM_FLAG_WR (DM_FLAGS_IALLOCSEM_WR | DM_FLAGS_ISEM) | 185 | #define DM_SEM_FLAG_WR (DM_FLAGS_IALLOCSEM_WR | DM_FLAGS_ISEM) |
184 | #else | 186 | #endif |
187 | |||
188 | #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,4,21) | ||
185 | #define DM_SEM_FLAG_RD(ioflags) (((ioflags) & IO_ISDIRECT) ? \ | 189 | #define DM_SEM_FLAG_RD(ioflags) (((ioflags) & IO_ISDIRECT) ? \ |
186 | 0 : DM_FLAGS_ISEM) | 190 | 0 : DM_FLAGS_ISEM) |
187 | #define DM_SEM_FLAG_WR (DM_FLAGS_ISEM) | 191 | #define DM_SEM_FLAG_WR (DM_FLAGS_ISEM) |
188 | #endif | 192 | #endif |
189 | 193 | ||
194 | |||
190 | /* | 195 | /* |
191 | * Macros to turn caller specified delay/block flags into | 196 | * Macros to turn caller specified delay/block flags into |
192 | * dm_send_xxxx_event flag DM_FLAGS_NDELAY. | 197 | * dm_send_xxxx_event flag DM_FLAGS_NDELAY. |
@@ -209,8 +214,4 @@ void xfs_dm_exit(struct file_system_type *); | |||
209 | #define XFS_DM_EXIT(fstype) | 214 | #define XFS_DM_EXIT(fstype) |
210 | #endif | 215 | #endif |
211 | 216 | ||
212 | #define HAVE_XFS_DM_MM | ||
213 | int xfs_dm_mm_get(struct vm_area_struct *vma); | ||
214 | void xfs_dm_mm_put(struct vm_area_struct *vma); | ||
215 | |||
216 | #endif /* __XFS_DMAPI_H__ */ | 217 | #endif /* __XFS_DMAPI_H__ */ |