aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ocfs2')
-rw-r--r--fs/ocfs2/cluster/heartbeat.c2
-rw-r--r--fs/ocfs2/super.c24
-rw-r--r--fs/ocfs2/symlink.c77
3 files changed, 47 insertions, 56 deletions
diff --git a/fs/ocfs2/cluster/heartbeat.c b/fs/ocfs2/cluster/heartbeat.c
index 4f85eceab376..09cc25d04611 100644
--- a/fs/ocfs2/cluster/heartbeat.c
+++ b/fs/ocfs2/cluster/heartbeat.c
@@ -1371,7 +1371,7 @@ static ssize_t o2hb_region_dev_write(struct o2hb_region *reg,
1371 1371
1372 bdevname(reg->hr_bdev, reg->hr_dev_name); 1372 bdevname(reg->hr_bdev, reg->hr_dev_name);
1373 1373
1374 sectsize = bdev_hardsect_size(reg->hr_bdev); 1374 sectsize = bdev_logical_block_size(reg->hr_bdev);
1375 if (sectsize != reg->hr_block_bytes) { 1375 if (sectsize != reg->hr_block_bytes) {
1376 mlog(ML_ERROR, 1376 mlog(ML_ERROR,
1377 "blocksize %u incorrect for device, expected %d", 1377 "blocksize %u incorrect for device, expected %d",
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c
index 4e6b8e7c423d..d33767f17ba3 100644
--- a/fs/ocfs2/super.c
+++ b/fs/ocfs2/super.c
@@ -42,6 +42,7 @@
42#include <linux/mount.h> 42#include <linux/mount.h>
43#include <linux/seq_file.h> 43#include <linux/seq_file.h>
44#include <linux/quotaops.h> 44#include <linux/quotaops.h>
45#include <linux/smp_lock.h>
45 46
46#define MLOG_MASK_PREFIX ML_SUPER 47#define MLOG_MASK_PREFIX ML_SUPER
47#include <cluster/masklog.h> 48#include <cluster/masklog.h>
@@ -128,7 +129,6 @@ static int ocfs2_get_sector(struct super_block *sb,
128 struct buffer_head **bh, 129 struct buffer_head **bh,
129 int block, 130 int block,
130 int sect_size); 131 int sect_size);
131static void ocfs2_write_super(struct super_block *sb);
132static struct inode *ocfs2_alloc_inode(struct super_block *sb); 132static struct inode *ocfs2_alloc_inode(struct super_block *sb);
133static void ocfs2_destroy_inode(struct inode *inode); 133static void ocfs2_destroy_inode(struct inode *inode);
134static int ocfs2_susp_quotas(struct ocfs2_super *osb, int unsuspend); 134static int ocfs2_susp_quotas(struct ocfs2_super *osb, int unsuspend);
@@ -143,7 +143,6 @@ static const struct super_operations ocfs2_sops = {
143 .clear_inode = ocfs2_clear_inode, 143 .clear_inode = ocfs2_clear_inode,
144 .delete_inode = ocfs2_delete_inode, 144 .delete_inode = ocfs2_delete_inode,
145 .sync_fs = ocfs2_sync_fs, 145 .sync_fs = ocfs2_sync_fs,
146 .write_super = ocfs2_write_super,
147 .put_super = ocfs2_put_super, 146 .put_super = ocfs2_put_super,
148 .remount_fs = ocfs2_remount, 147 .remount_fs = ocfs2_remount,
149 .show_options = ocfs2_show_options, 148 .show_options = ocfs2_show_options,
@@ -375,24 +374,12 @@ static struct file_operations ocfs2_osb_debug_fops = {
375 .llseek = generic_file_llseek, 374 .llseek = generic_file_llseek,
376}; 375};
377 376
378/*
379 * write_super and sync_fs ripped right out of ext3.
380 */
381static void ocfs2_write_super(struct super_block *sb)
382{
383 if (mutex_trylock(&sb->s_lock) != 0)
384 BUG();
385 sb->s_dirt = 0;
386}
387
388static int ocfs2_sync_fs(struct super_block *sb, int wait) 377static int ocfs2_sync_fs(struct super_block *sb, int wait)
389{ 378{
390 int status; 379 int status;
391 tid_t target; 380 tid_t target;
392 struct ocfs2_super *osb = OCFS2_SB(sb); 381 struct ocfs2_super *osb = OCFS2_SB(sb);
393 382
394 sb->s_dirt = 0;
395
396 if (ocfs2_is_hard_readonly(osb)) 383 if (ocfs2_is_hard_readonly(osb))
397 return -EROFS; 384 return -EROFS;
398 385
@@ -605,6 +592,8 @@ static int ocfs2_remount(struct super_block *sb, int *flags, char *data)
605 struct mount_options parsed_options; 592 struct mount_options parsed_options;
606 struct ocfs2_super *osb = OCFS2_SB(sb); 593 struct ocfs2_super *osb = OCFS2_SB(sb);
607 594
595 lock_kernel();
596
608 if (!ocfs2_parse_options(sb, data, &parsed_options, 1)) { 597 if (!ocfs2_parse_options(sb, data, &parsed_options, 1)) {
609 ret = -EINVAL; 598 ret = -EINVAL;
610 goto out; 599 goto out;
@@ -708,6 +697,7 @@ unlock_osb:
708 ocfs2_set_journal_params(osb); 697 ocfs2_set_journal_params(osb);
709 } 698 }
710out: 699out:
700 unlock_kernel();
711 return ret; 701 return ret;
712} 702}
713 703
@@ -724,7 +714,7 @@ static int ocfs2_sb_probe(struct super_block *sb,
724 *bh = NULL; 714 *bh = NULL;
725 715
726 /* may be > 512 */ 716 /* may be > 512 */
727 *sector_size = bdev_hardsect_size(sb->s_bdev); 717 *sector_size = bdev_logical_block_size(sb->s_bdev);
728 if (*sector_size > OCFS2_MAX_BLOCKSIZE) { 718 if (*sector_size > OCFS2_MAX_BLOCKSIZE) {
729 mlog(ML_ERROR, "Hardware sector size too large: %d (max=%d)\n", 719 mlog(ML_ERROR, "Hardware sector size too large: %d (max=%d)\n",
730 *sector_size, OCFS2_MAX_BLOCKSIZE); 720 *sector_size, OCFS2_MAX_BLOCKSIZE);
@@ -1575,9 +1565,13 @@ static void ocfs2_put_super(struct super_block *sb)
1575{ 1565{
1576 mlog_entry("(0x%p)\n", sb); 1566 mlog_entry("(0x%p)\n", sb);
1577 1567
1568 lock_kernel();
1569
1578 ocfs2_sync_blockdev(sb); 1570 ocfs2_sync_blockdev(sb);
1579 ocfs2_dismount_volume(sb, 0); 1571 ocfs2_dismount_volume(sb, 0);
1580 1572
1573 unlock_kernel();
1574
1581 mlog_exit_void(); 1575 mlog_exit_void();
1582} 1576}
1583 1577
diff --git a/fs/ocfs2/symlink.c b/fs/ocfs2/symlink.c
index ed0a0cfd68d2..579dd1b1110f 100644
--- a/fs/ocfs2/symlink.c
+++ b/fs/ocfs2/symlink.c
@@ -39,6 +39,7 @@
39#include <linux/slab.h> 39#include <linux/slab.h>
40#include <linux/pagemap.h> 40#include <linux/pagemap.h>
41#include <linux/utsname.h> 41#include <linux/utsname.h>
42#include <linux/namei.h>
42 43
43#define MLOG_MASK_PREFIX ML_NAMEI 44#define MLOG_MASK_PREFIX ML_NAMEI
44#include <cluster/masklog.h> 45#include <cluster/masklog.h>
@@ -54,26 +55,6 @@
54 55
55#include "buffer_head_io.h" 56#include "buffer_head_io.h"
56 57
57static char *ocfs2_page_getlink(struct dentry * dentry,
58 struct page **ppage);
59static char *ocfs2_fast_symlink_getlink(struct inode *inode,
60 struct buffer_head **bh);
61
62/* get the link contents into pagecache */
63static char *ocfs2_page_getlink(struct dentry * dentry,
64 struct page **ppage)
65{
66 struct page * page;
67 struct address_space *mapping = dentry->d_inode->i_mapping;
68 page = read_mapping_page(mapping, 0, NULL);
69 if (IS_ERR(page))
70 goto sync_fail;
71 *ppage = page;
72 return kmap(page);
73
74sync_fail:
75 return (char*)page;
76}
77 58
78static char *ocfs2_fast_symlink_getlink(struct inode *inode, 59static char *ocfs2_fast_symlink_getlink(struct inode *inode,
79 struct buffer_head **bh) 60 struct buffer_head **bh)
@@ -128,40 +109,55 @@ out:
128 return ret; 109 return ret;
129} 110}
130 111
131static void *ocfs2_follow_link(struct dentry *dentry, 112static void *ocfs2_fast_follow_link(struct dentry *dentry,
132 struct nameidata *nd) 113 struct nameidata *nd)
133{ 114{
134 int status; 115 int status = 0;
135 char *link; 116 int len;
117 char *target, *link = ERR_PTR(-ENOMEM);
136 struct inode *inode = dentry->d_inode; 118 struct inode *inode = dentry->d_inode;
137 struct page *page = NULL;
138 struct buffer_head *bh = NULL; 119 struct buffer_head *bh = NULL;
139 120
140 if (ocfs2_inode_is_fast_symlink(inode)) 121 mlog_entry_void();
141 link = ocfs2_fast_symlink_getlink(inode, &bh); 122
142 else 123 BUG_ON(!ocfs2_inode_is_fast_symlink(inode));
143 link = ocfs2_page_getlink(dentry, &page); 124 target = ocfs2_fast_symlink_getlink(inode, &bh);
144 if (IS_ERR(link)) { 125 if (IS_ERR(target)) {
145 status = PTR_ERR(link); 126 status = PTR_ERR(target);
146 mlog_errno(status); 127 mlog_errno(status);
147 goto bail; 128 goto bail;
148 } 129 }
149 130
150 status = vfs_follow_link(nd, link); 131 /* Fast symlinks can't be large */
132 len = strlen(target);
133 link = kzalloc(len + 1, GFP_NOFS);
134 if (!link) {
135 status = -ENOMEM;
136 mlog_errno(status);
137 goto bail;
138 }
139
140 memcpy(link, target, len);
141 nd_set_link(nd, link);
151 142
152bail: 143bail:
153 if (page) {
154 kunmap(page);
155 page_cache_release(page);
156 }
157 brelse(bh); 144 brelse(bh);
158 145
159 return ERR_PTR(status); 146 mlog_exit(status);
147 return status ? ERR_PTR(status) : link;
148}
149
150static void ocfs2_fast_put_link(struct dentry *dentry, struct nameidata *nd, void *cookie)
151{
152 char *link = cookie;
153
154 kfree(link);
160} 155}
161 156
162const struct inode_operations ocfs2_symlink_inode_operations = { 157const struct inode_operations ocfs2_symlink_inode_operations = {
163 .readlink = page_readlink, 158 .readlink = page_readlink,
164 .follow_link = ocfs2_follow_link, 159 .follow_link = page_follow_link_light,
160 .put_link = page_put_link,
165 .getattr = ocfs2_getattr, 161 .getattr = ocfs2_getattr,
166 .setattr = ocfs2_setattr, 162 .setattr = ocfs2_setattr,
167 .setxattr = generic_setxattr, 163 .setxattr = generic_setxattr,
@@ -171,7 +167,8 @@ const struct inode_operations ocfs2_symlink_inode_operations = {
171}; 167};
172const struct inode_operations ocfs2_fast_symlink_inode_operations = { 168const struct inode_operations ocfs2_fast_symlink_inode_operations = {
173 .readlink = ocfs2_readlink, 169 .readlink = ocfs2_readlink,
174 .follow_link = ocfs2_follow_link, 170 .follow_link = ocfs2_fast_follow_link,
171 .put_link = ocfs2_fast_put_link,
175 .getattr = ocfs2_getattr, 172 .getattr = ocfs2_getattr,
176 .setattr = ocfs2_setattr, 173 .setattr = ocfs2_setattr,
177 .setxattr = generic_setxattr, 174 .setxattr = generic_setxattr,