summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/inode.c
diff options
context:
space:
mode:
authorYan Zheng2008-11-12 20:34:12 +0100
committerChris Mason2008-11-12 20:34:12 +0100
commitc146afad2c7fea6a366d4945c1bab9b03880f526 (patch)
treedd217139525a521895125843ca31f61cfbb49dca /fs/btrfs/inode.c
parentBtrfs: batch extent inserts/updates/deletions on the extent root (diff)
downloadkernel-qcow2-linux-c146afad2c7fea6a366d4945c1bab9b03880f526.tar.gz
kernel-qcow2-linux-c146afad2c7fea6a366d4945c1bab9b03880f526.tar.xz
kernel-qcow2-linux-c146afad2c7fea6a366d4945c1bab9b03880f526.zip
Btrfs: mount ro and remount support
This patch adds mount ro and remount support. The main changes in patch are: adding btrfs_remount and related helper function; splitting the transaction related code out of close_ctree into btrfs_commit_super; updating allocator to properly handle read only block group. Signed-off-by: Yan Zheng <zheng.yan@oracle.com>
Diffstat (limited to 'fs/btrfs/inode.c')
-rw-r--r--fs/btrfs/inode.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 2ed2deacde90..3e3620e69bb9 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -1808,10 +1808,6 @@ void btrfs_orphan_cleanup(struct btrfs_root *root)
struct inode *inode;
int ret = 0, nr_unlink = 0, nr_truncate = 0;
- /* don't do orphan cleanup if the fs is readonly. */
- if (root->fs_info->sb->s_flags & MS_RDONLY)
- return;
-
path = btrfs_alloc_path();
if (!path)
return;
@@ -3050,7 +3046,7 @@ static struct dentry *btrfs_lookup(struct inode *dir, struct dentry *dentry,
struct btrfs_root *root = bi->root;
struct btrfs_root *sub_root = root;
struct btrfs_key location;
- int ret, new, do_orphan = 0;
+ int ret, new;
if (dentry->d_name.len > BTRFS_NAME_LEN)
return ERR_PTR(-ENAMETOOLONG);
@@ -3076,13 +3072,9 @@ static struct dentry *btrfs_lookup(struct inode *dir, struct dentry *dentry,
if (new && root != sub_root) {
igrab(inode);
sub_root->inode = inode;
- do_orphan = 1;
}
}
- if (unlikely(do_orphan))
- btrfs_orphan_cleanup(sub_root);
-
return d_splice_alias(inode, dentry);
}
@@ -3237,7 +3229,7 @@ int btrfs_write_inode(struct inode *inode, int wait)
struct btrfs_trans_handle *trans;
int ret = 0;
- if (root->fs_info->closing > 1)
+ if (root->fs_info->btree_inode == inode)
return 0;
if (wait) {
@@ -4625,6 +4617,9 @@ int btrfs_start_delalloc_inodes(struct btrfs_root *root)
struct inode *inode;
unsigned long flags;
+ if (root->fs_info->sb->s_flags & MS_RDONLY)
+ return -EROFS;
+
spin_lock_irqsave(&root->fs_info->delalloc_lock, flags);
while(!list_empty(head)) {
binode = list_entry(head->next, struct btrfs_inode,