summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2009-07-26 17:38:49 +0200
committerThomas Gleixner <tglx@linutronix.de>2009-07-27 13:36:17 +0200
commit087498eea02acae08627e310d58ec837a54752d7 (patch)
tree257ba8e7a78d04d9cf6283b271520724bfa19e1f /fs
parent7715da0b24745db15637f9d380f65386e3d9478b (diff)
downloadlwn-087498eea02acae08627e310d58ec837a54752d7.tar.gz
lwn-087498eea02acae08627e310d58ec837a54752d7.zip
fs: Convert i_alloc_sem to rw_anon_semaphore
i_alloc_sem is used as a completion in direct-io which does not follow owner rules. preempt-rt needs to keep it as such. So convert it to rw_anon_semaphore and annotate the semantics hereby. Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'fs')
-rw-r--r--fs/attr.c4
-rw-r--r--fs/direct-io.c4
-rw-r--r--fs/ext4/inode.c4
-rw-r--r--fs/fat/inode.c4
-rw-r--r--fs/inode.c2
-rw-r--r--fs/nilfs2/mdt.c2
-rw-r--r--fs/ntfs/file.c4
-rw-r--r--fs/ocfs2/aops.c2
-rw-r--r--fs/ocfs2/file.c10
-rw-r--r--fs/reiserfs/xattr.c4
10 files changed, 20 insertions, 20 deletions
diff --git a/fs/attr.c b/fs/attr.c
index 9fe1b1bd30a8..5c8f5be5d638 100644
--- a/fs/attr.c
+++ b/fs/attr.c
@@ -164,7 +164,7 @@ int notify_change(struct dentry * dentry, struct iattr * attr)
return error;
if (ia_valid & ATTR_SIZE)
- down_write(&dentry->d_inode->i_alloc_sem);
+ anon_down_write(&dentry->d_inode->i_alloc_sem);
if (inode->i_op && inode->i_op->setattr) {
error = inode->i_op->setattr(dentry, attr);
@@ -181,7 +181,7 @@ int notify_change(struct dentry * dentry, struct iattr * attr)
}
if (ia_valid & ATTR_SIZE)
- up_write(&dentry->d_inode->i_alloc_sem);
+ anon_up_write(&dentry->d_inode->i_alloc_sem);
if (!error)
fsnotify_change(dentry, ia_valid);
diff --git a/fs/direct-io.c b/fs/direct-io.c
index 8b10b87dc01a..ab9ae61baedd 100644
--- a/fs/direct-io.c
+++ b/fs/direct-io.c
@@ -242,7 +242,7 @@ static int dio_complete(struct dio *dio, loff_t offset, int ret)
dio->map_bh.b_private);
if (dio->lock_type == DIO_LOCKING)
/* lockdep: non-owner release */
- up_read_non_owner(&dio->inode->i_alloc_sem);
+ anon_up_read_non_owner(&dio->inode->i_alloc_sem);
if (ret == 0)
ret = dio->page_errors;
@@ -1192,7 +1192,7 @@ __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode,
if (dio_lock_type == DIO_LOCKING)
/* lockdep: not the owner will release it */
- down_read_non_owner(&inode->i_alloc_sem);
+ anon_down_read_non_owner(&inode->i_alloc_sem);
}
/*
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index f9c642b22efa..5ad50b2ccfa8 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -5265,7 +5265,7 @@ int ext4_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
* Get i_alloc_sem to stop truncates messing with the inode. We cannot
* get i_mutex because we are already holding mmap_sem.
*/
- down_read(&inode->i_alloc_sem);
+ anon_down_read(&inode->i_alloc_sem);
size = i_size_read(inode);
if (page->mapping != mapping || size <= page_offset(page)
|| !PageUptodate(page)) {
@@ -5306,6 +5306,6 @@ int ext4_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
out_unlock:
if (ret)
ret = VM_FAULT_SIGBUS;
- up_read(&inode->i_alloc_sem);
+ anon_up_read(&inode->i_alloc_sem);
return ret;
}
diff --git a/fs/fat/inode.c b/fs/fat/inode.c
index 8970d8c49bb0..da8dbb1ac5f9 100644
--- a/fs/fat/inode.c
+++ b/fs/fat/inode.c
@@ -202,9 +202,9 @@ static sector_t _fat_bmap(struct address_space *mapping, sector_t block)
sector_t blocknr;
/* fat_get_cluster() assumes the requested blocknr isn't truncated. */
- down_read(&mapping->host->i_alloc_sem);
+ anon_down_read(&mapping->host->i_alloc_sem);
blocknr = generic_block_bmap(mapping, block, fat_get_block);
- up_read(&mapping->host->i_alloc_sem);
+ anon_up_read(&mapping->host->i_alloc_sem);
return blocknr;
}
diff --git a/fs/inode.c b/fs/inode.c
index 901bad1e5f12..cb277d694a32 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -164,7 +164,7 @@ struct inode *inode_init_always(struct super_block *sb, struct inode *inode)
mutex_init(&inode->i_mutex);
lockdep_set_class(&inode->i_mutex, &sb->s_type->i_mutex_key);
- init_rwsem(&inode->i_alloc_sem);
+ init_anon_rwsem(&inode->i_alloc_sem);
lockdep_set_class(&inode->i_alloc_sem, &sb->s_type->i_alloc_sem_key);
mapping->a_ops = &empty_aops;
diff --git a/fs/nilfs2/mdt.c b/fs/nilfs2/mdt.c
index 3d3ddb3f5177..1fe77872cf50 100644
--- a/fs/nilfs2/mdt.c
+++ b/fs/nilfs2/mdt.c
@@ -499,7 +499,7 @@ nilfs_mdt_new_common(struct the_nilfs *nilfs, struct super_block *sb,
spin_lock_init(&inode->i_lock);
mutex_init(&inode->i_mutex);
- init_rwsem(&inode->i_alloc_sem);
+ init_anon_rwsem(&inode->i_alloc_sem);
mapping->host = NULL; /* instead of inode */
mapping->flags = 0;
diff --git a/fs/ntfs/file.c b/fs/ntfs/file.c
index 3140a4429af1..9f07b9c44a17 100644
--- a/fs/ntfs/file.c
+++ b/fs/ntfs/file.c
@@ -1845,9 +1845,9 @@ static ssize_t ntfs_file_buffered_write(struct kiocb *iocb,
* fails again.
*/
if (unlikely(NInoTruncateFailed(ni))) {
- down_write(&vi->i_alloc_sem);
+ anon_down_write(&vi->i_alloc_sem);
err = ntfs_truncate(vi);
- up_write(&vi->i_alloc_sem);
+ anon_up_write(&vi->i_alloc_sem);
if (err || NInoTruncateFailed(ni)) {
if (!err)
err = -EIO;
diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c
index b2c52b3a1484..ad39c278afd4 100644
--- a/fs/ocfs2/aops.c
+++ b/fs/ocfs2/aops.c
@@ -642,7 +642,7 @@ static void ocfs2_dio_end_io(struct kiocb *iocb,
level = ocfs2_iocb_rw_locked_level(iocb);
if (!level)
- up_read(&inode->i_alloc_sem);
+ anon_up_read(&inode->i_alloc_sem);
ocfs2_rw_unlock(inode, level);
}
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
index 62442e413a00..96034230adb6 100644
--- a/fs/ocfs2/file.c
+++ b/fs/ocfs2/file.c
@@ -1799,7 +1799,7 @@ static ssize_t ocfs2_file_aio_write(struct kiocb *iocb,
relock:
/* to match setattr's i_mutex -> i_alloc_sem -> rw_lock ordering */
if (direct_io) {
- down_read(&inode->i_alloc_sem);
+ anon_down_read(&inode->i_alloc_sem);
have_alloc_sem = 1;
}
@@ -1826,7 +1826,7 @@ relock:
*/
if (direct_io && !can_do_direct) {
ocfs2_rw_unlock(inode, rw_level);
- up_read(&inode->i_alloc_sem);
+ anon_up_read(&inode->i_alloc_sem);
have_alloc_sem = 0;
rw_level = -1;
@@ -1914,7 +1914,7 @@ out:
out_sems:
if (have_alloc_sem)
- up_read(&inode->i_alloc_sem);
+ anon_up_read(&inode->i_alloc_sem);
mutex_unlock(&inode->i_mutex);
@@ -2076,7 +2076,7 @@ static ssize_t ocfs2_file_aio_read(struct kiocb *iocb,
* need locks to protect pending reads from racing with truncate.
*/
if (filp->f_flags & O_DIRECT) {
- down_read(&inode->i_alloc_sem);
+ anon_down_read(&inode->i_alloc_sem);
have_alloc_sem = 1;
ret = ocfs2_rw_lock(inode, 0);
@@ -2120,7 +2120,7 @@ static ssize_t ocfs2_file_aio_read(struct kiocb *iocb,
bail:
if (have_alloc_sem)
- up_read(&inode->i_alloc_sem);
+ anon_up_read(&inode->i_alloc_sem);
if (rw_level != -1)
ocfs2_rw_unlock(inode, rw_level);
mlog_exit(ret);
diff --git a/fs/reiserfs/xattr.c b/fs/reiserfs/xattr.c
index 6925b835a43b..45a1c141c79c 100644
--- a/fs/reiserfs/xattr.c
+++ b/fs/reiserfs/xattr.c
@@ -540,9 +540,9 @@ reiserfs_xattr_set_handle(struct reiserfs_transaction_handle *th,
.ia_valid = ATTR_SIZE | ATTR_CTIME,
};
mutex_lock_nested(&dentry->d_inode->i_mutex, I_MUTEX_XATTR);
- down_write(&dentry->d_inode->i_alloc_sem);
+ anon_down_write(&dentry->d_inode->i_alloc_sem);
err = reiserfs_setattr(dentry, &newattrs);
- up_write(&dentry->d_inode->i_alloc_sem);
+ anon_up_write(&dentry->d_inode->i_alloc_sem);
mutex_unlock(&dentry->d_inode->i_mutex);
} else
update_ctime(inode);