diff options
author | Jes Sorensen <jes@sgi.com> | 2006-01-09 18:59:24 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@hera.kernel.org> | 2006-01-09 18:59:24 -0500 |
commit | 1b1dcc1b57a49136f118a0f16367256ff9994a69 (patch) | |
tree | b0b36d4f41d28c9d6514fb309d33c1a084d6309b /fs/xfs | |
parent | 794ee1baee1c26be40410233e6c20bceb2b03c08 (diff) |
[PATCH] mutex subsystem, semaphore to mutex: VFS, ->i_sem
This patch converts the inode semaphore to a mutex. I have tested it on
XFS and compiled as much as one can consider on an ia64. Anyway your
luck with it might be different.
Modified-by: Ingo Molnar <mingo@elte.hu>
(finished the conversion)
Signed-off-by: Jes Sorensen <jes@sgi.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'fs/xfs')
-rw-r--r-- | fs/xfs/linux-2.6/xfs_iops.c | 2 | ||||
-rw-r--r-- | fs/xfs/linux-2.6/xfs_lrw.c | 18 | ||||
-rw-r--r-- | fs/xfs/xfs_dmapi.h | 14 |
3 files changed, 17 insertions, 17 deletions
diff --git a/fs/xfs/linux-2.6/xfs_iops.c b/fs/xfs/linux-2.6/xfs_iops.c index 14215a7db59f..41c478bb1ffc 100644 --- a/fs/xfs/linux-2.6/xfs_iops.c +++ b/fs/xfs/linux-2.6/xfs_iops.c | |||
@@ -203,7 +203,7 @@ validate_fields( | |||
203 | ip->i_nlink = va.va_nlink; | 203 | ip->i_nlink = va.va_nlink; |
204 | ip->i_blocks = va.va_nblocks; | 204 | ip->i_blocks = va.va_nblocks; |
205 | 205 | ||
206 | /* we're under i_sem so i_size can't change under us */ | 206 | /* we're under i_mutex so i_size can't change under us */ |
207 | if (i_size_read(ip) != va.va_size) | 207 | if (i_size_read(ip) != va.va_size) |
208 | i_size_write(ip, va.va_size); | 208 | i_size_write(ip, va.va_size); |
209 | } | 209 | } |
diff --git a/fs/xfs/linux-2.6/xfs_lrw.c b/fs/xfs/linux-2.6/xfs_lrw.c index 279e9bc92aba..5675117ef227 100644 --- a/fs/xfs/linux-2.6/xfs_lrw.c +++ b/fs/xfs/linux-2.6/xfs_lrw.c | |||
@@ -254,7 +254,7 @@ xfs_read( | |||
254 | } | 254 | } |
255 | 255 | ||
256 | if (unlikely(ioflags & IO_ISDIRECT)) | 256 | if (unlikely(ioflags & IO_ISDIRECT)) |
257 | down(&inode->i_sem); | 257 | mutex_lock(&inode->i_mutex); |
258 | xfs_ilock(ip, XFS_IOLOCK_SHARED); | 258 | xfs_ilock(ip, XFS_IOLOCK_SHARED); |
259 | 259 | ||
260 | if (DM_EVENT_ENABLED(vp->v_vfsp, ip, DM_EVENT_READ) && | 260 | if (DM_EVENT_ENABLED(vp->v_vfsp, ip, DM_EVENT_READ) && |
@@ -286,7 +286,7 @@ xfs_read( | |||
286 | 286 | ||
287 | unlock_isem: | 287 | unlock_isem: |
288 | if (unlikely(ioflags & IO_ISDIRECT)) | 288 | if (unlikely(ioflags & IO_ISDIRECT)) |
289 | up(&inode->i_sem); | 289 | mutex_unlock(&inode->i_mutex); |
290 | return ret; | 290 | return ret; |
291 | } | 291 | } |
292 | 292 | ||
@@ -655,7 +655,7 @@ relock: | |||
655 | iolock = XFS_IOLOCK_EXCL; | 655 | iolock = XFS_IOLOCK_EXCL; |
656 | locktype = VRWLOCK_WRITE; | 656 | locktype = VRWLOCK_WRITE; |
657 | 657 | ||
658 | down(&inode->i_sem); | 658 | mutex_lock(&inode->i_mutex); |
659 | } else { | 659 | } else { |
660 | iolock = XFS_IOLOCK_SHARED; | 660 | iolock = XFS_IOLOCK_SHARED; |
661 | locktype = VRWLOCK_WRITE_DIRECT; | 661 | locktype = VRWLOCK_WRITE_DIRECT; |
@@ -686,7 +686,7 @@ start: | |||
686 | int dmflags = FILP_DELAY_FLAG(file); | 686 | int dmflags = FILP_DELAY_FLAG(file); |
687 | 687 | ||
688 | if (need_isem) | 688 | if (need_isem) |
689 | dmflags |= DM_FLAGS_ISEM; | 689 | dmflags |= DM_FLAGS_IMUX; |
690 | 690 | ||
691 | xfs_iunlock(xip, XFS_ILOCK_EXCL); | 691 | xfs_iunlock(xip, XFS_ILOCK_EXCL); |
692 | error = XFS_SEND_DATA(xip->i_mount, DM_EVENT_WRITE, vp, | 692 | error = XFS_SEND_DATA(xip->i_mount, DM_EVENT_WRITE, vp, |
@@ -772,7 +772,7 @@ retry: | |||
772 | if (need_isem) { | 772 | if (need_isem) { |
773 | /* demote the lock now the cached pages are gone */ | 773 | /* demote the lock now the cached pages are gone */ |
774 | XFS_ILOCK_DEMOTE(mp, io, XFS_IOLOCK_EXCL); | 774 | XFS_ILOCK_DEMOTE(mp, io, XFS_IOLOCK_EXCL); |
775 | up(&inode->i_sem); | 775 | mutex_unlock(&inode->i_mutex); |
776 | 776 | ||
777 | iolock = XFS_IOLOCK_SHARED; | 777 | iolock = XFS_IOLOCK_SHARED; |
778 | locktype = VRWLOCK_WRITE_DIRECT; | 778 | locktype = VRWLOCK_WRITE_DIRECT; |
@@ -817,14 +817,14 @@ retry: | |||
817 | 817 | ||
818 | xfs_rwunlock(bdp, locktype); | 818 | xfs_rwunlock(bdp, locktype); |
819 | if (need_isem) | 819 | if (need_isem) |
820 | up(&inode->i_sem); | 820 | mutex_unlock(&inode->i_mutex); |
821 | error = XFS_SEND_NAMESP(xip->i_mount, DM_EVENT_NOSPACE, vp, | 821 | error = XFS_SEND_NAMESP(xip->i_mount, DM_EVENT_NOSPACE, vp, |
822 | DM_RIGHT_NULL, vp, DM_RIGHT_NULL, NULL, NULL, | 822 | DM_RIGHT_NULL, vp, DM_RIGHT_NULL, NULL, NULL, |
823 | 0, 0, 0); /* Delay flag intentionally unused */ | 823 | 0, 0, 0); /* Delay flag intentionally unused */ |
824 | if (error) | 824 | if (error) |
825 | goto out_nounlocks; | 825 | goto out_nounlocks; |
826 | if (need_isem) | 826 | if (need_isem) |
827 | down(&inode->i_sem); | 827 | mutex_lock(&inode->i_mutex); |
828 | xfs_rwlock(bdp, locktype); | 828 | xfs_rwlock(bdp, locktype); |
829 | pos = xip->i_d.di_size; | 829 | pos = xip->i_d.di_size; |
830 | ret = 0; | 830 | ret = 0; |
@@ -926,7 +926,7 @@ retry: | |||
926 | 926 | ||
927 | xfs_rwunlock(bdp, locktype); | 927 | xfs_rwunlock(bdp, locktype); |
928 | if (need_isem) | 928 | if (need_isem) |
929 | up(&inode->i_sem); | 929 | mutex_unlock(&inode->i_mutex); |
930 | 930 | ||
931 | error = sync_page_range(inode, mapping, pos, ret); | 931 | error = sync_page_range(inode, mapping, pos, ret); |
932 | if (!error) | 932 | if (!error) |
@@ -938,7 +938,7 @@ retry: | |||
938 | xfs_rwunlock(bdp, locktype); | 938 | xfs_rwunlock(bdp, locktype); |
939 | out_unlock_isem: | 939 | out_unlock_isem: |
940 | if (need_isem) | 940 | if (need_isem) |
941 | up(&inode->i_sem); | 941 | mutex_unlock(&inode->i_mutex); |
942 | out_nounlocks: | 942 | out_nounlocks: |
943 | return -error; | 943 | return -error; |
944 | } | 944 | } |
diff --git a/fs/xfs/xfs_dmapi.h b/fs/xfs/xfs_dmapi.h index 864bf6955689..b4c7f2bc55a0 100644 --- a/fs/xfs/xfs_dmapi.h +++ b/fs/xfs/xfs_dmapi.h | |||
@@ -152,7 +152,7 @@ typedef enum { | |||
152 | 152 | ||
153 | #define DM_FLAGS_NDELAY 0x001 /* return EAGAIN after dm_pending() */ | 153 | #define DM_FLAGS_NDELAY 0x001 /* return EAGAIN after dm_pending() */ |
154 | #define DM_FLAGS_UNWANTED 0x002 /* event not in fsys dm_eventset_t */ | 154 | #define DM_FLAGS_UNWANTED 0x002 /* event not in fsys dm_eventset_t */ |
155 | #define DM_FLAGS_ISEM 0x004 /* thread holds i_sem */ | 155 | #define DM_FLAGS_IMUX 0x004 /* thread holds i_mutex */ |
156 | #define DM_FLAGS_IALLOCSEM_RD 0x010 /* thread holds i_alloc_sem rd */ | 156 | #define DM_FLAGS_IALLOCSEM_RD 0x010 /* thread holds i_alloc_sem rd */ |
157 | #define DM_FLAGS_IALLOCSEM_WR 0x020 /* thread holds i_alloc_sem wr */ | 157 | #define DM_FLAGS_IALLOCSEM_WR 0x020 /* thread holds i_alloc_sem wr */ |
158 | 158 | ||
@@ -161,21 +161,21 @@ typedef enum { | |||
161 | */ | 161 | */ |
162 | #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) | 162 | #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) |
163 | #define DM_SEM_FLAG_RD(ioflags) (((ioflags) & IO_ISDIRECT) ? \ | 163 | #define DM_SEM_FLAG_RD(ioflags) (((ioflags) & IO_ISDIRECT) ? \ |
164 | DM_FLAGS_ISEM : 0) | 164 | DM_FLAGS_IMUX : 0) |
165 | #define DM_SEM_FLAG_WR (DM_FLAGS_IALLOCSEM_WR | DM_FLAGS_ISEM) | 165 | #define DM_SEM_FLAG_WR (DM_FLAGS_IALLOCSEM_WR | DM_FLAGS_IMUX) |
166 | #endif | 166 | #endif |
167 | 167 | ||
168 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)) && \ | 168 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)) && \ |
169 | (LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,22)) | 169 | (LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,22)) |
170 | #define DM_SEM_FLAG_RD(ioflags) (((ioflags) & IO_ISDIRECT) ? \ | 170 | #define DM_SEM_FLAG_RD(ioflags) (((ioflags) & IO_ISDIRECT) ? \ |
171 | DM_FLAGS_IALLOCSEM_RD : DM_FLAGS_ISEM) | 171 | DM_FLAGS_IALLOCSEM_RD : DM_FLAGS_IMUX) |
172 | #define DM_SEM_FLAG_WR (DM_FLAGS_IALLOCSEM_WR | DM_FLAGS_ISEM) | 172 | #define DM_SEM_FLAG_WR (DM_FLAGS_IALLOCSEM_WR | DM_FLAGS_IMUX) |
173 | #endif | 173 | #endif |
174 | 174 | ||
175 | #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,4,21) | 175 | #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,4,21) |
176 | #define DM_SEM_FLAG_RD(ioflags) (((ioflags) & IO_ISDIRECT) ? \ | 176 | #define DM_SEM_FLAG_RD(ioflags) (((ioflags) & IO_ISDIRECT) ? \ |
177 | 0 : DM_FLAGS_ISEM) | 177 | 0 : DM_FLAGS_IMUX) |
178 | #define DM_SEM_FLAG_WR (DM_FLAGS_ISEM) | 178 | #define DM_SEM_FLAG_WR (DM_FLAGS_IMUX) |
179 | #endif | 179 | #endif |
180 | 180 | ||
181 | 181 | ||