aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/inode.c
diff options
context:
space:
mode:
authorYan Zheng <zheng.yan@oracle.com>2008-11-12 14:34:12 -0500
committerChris Mason <chris.mason@oracle.com>2008-11-12 14:34:12 -0500
commitc146afad2c7fea6a366d4945c1bab9b03880f526 (patch)
treedd217139525a521895125843ca31f61cfbb49dca /fs/btrfs/inode.c
parentf3465ca44e2a51fd647c167045768a8ab5a96603 (diff)
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)
1808 struct inode *inode; 1808 struct inode *inode;
1809 int ret = 0, nr_unlink = 0, nr_truncate = 0; 1809 int ret = 0, nr_unlink = 0, nr_truncate = 0;
1810 1810
1811 /* don't do orphan cleanup if the fs is readonly. */
1812 if (root->fs_info->sb->s_flags & MS_RDONLY)
1813 return;
1814
1815 path = btrfs_alloc_path(); 1811 path = btrfs_alloc_path();
1816 if (!path) 1812 if (!path)
1817 return; 1813 return;
@@ -3050,7 +3046,7 @@ static struct dentry *btrfs_lookup(struct inode *dir, struct dentry *dentry,
3050 struct btrfs_root *root = bi->root; 3046 struct btrfs_root *root = bi->root;
3051 struct btrfs_root *sub_root = root; 3047 struct btrfs_root *sub_root = root;
3052 struct btrfs_key location; 3048 struct btrfs_key location;
3053 int ret, new, do_orphan = 0; 3049 int ret, new;
3054 3050
3055 if (dentry->d_name.len > BTRFS_NAME_LEN) 3051 if (dentry->d_name.len > BTRFS_NAME_LEN)
3056 return ERR_PTR(-ENAMETOOLONG); 3052 return ERR_PTR(-ENAMETOOLONG);
@@ -3076,13 +3072,9 @@ static struct dentry *btrfs_lookup(struct inode *dir, struct dentry *dentry,
3076 if (new && root != sub_root) { 3072 if (new && root != sub_root) {
3077 igrab(inode); 3073 igrab(inode);
3078 sub_root->inode = inode; 3074 sub_root->inode = inode;
3079 do_orphan = 1;
3080 } 3075 }
3081 } 3076 }
3082 3077
3083 if (unlikely(do_orphan))
3084 btrfs_orphan_cleanup(sub_root);
3085
3086 return d_splice_alias(inode, dentry); 3078 return d_splice_alias(inode, dentry);
3087} 3079}
3088 3080
@@ -3237,7 +3229,7 @@ int btrfs_write_inode(struct inode *inode, int wait)
3237 struct btrfs_trans_handle *trans; 3229 struct btrfs_trans_handle *trans;
3238 int ret = 0; 3230 int ret = 0;
3239 3231
3240 if (root->fs_info->closing > 1) 3232 if (root->fs_info->btree_inode == inode)
3241 return 0; 3233 return 0;
3242 3234
3243 if (wait) { 3235 if (wait) {
@@ -4625,6 +4617,9 @@ int btrfs_start_delalloc_inodes(struct btrfs_root *root)
4625 struct inode *inode; 4617 struct inode *inode;
4626 unsigned long flags; 4618 unsigned long flags;
4627 4619
4620 if (root->fs_info->sb->s_flags & MS_RDONLY)
4621 return -EROFS;
4622
4628 spin_lock_irqsave(&root->fs_info->delalloc_lock, flags); 4623 spin_lock_irqsave(&root->fs_info->delalloc_lock, flags);
4629 while(!list_empty(head)) { 4624 while(!list_empty(head)) {
4630 binode = list_entry(head->next, struct btrfs_inode, 4625 binode = list_entry(head->next, struct btrfs_inode,