diff options
Diffstat (limited to 'fs/gfs2')
-rw-r--r-- | fs/gfs2/aops.c | 4 | ||||
-rw-r--r-- | fs/gfs2/bmap.c | 2 | ||||
-rw-r--r-- | fs/gfs2/glock.c | 75 | ||||
-rw-r--r-- | fs/gfs2/glock.h | 7 | ||||
-rw-r--r-- | fs/gfs2/glops.c | 16 | ||||
-rw-r--r-- | fs/gfs2/incore.h | 5 | ||||
-rw-r--r-- | fs/gfs2/inode.c | 6 | ||||
-rw-r--r-- | fs/gfs2/lock_dlm.c | 5 | ||||
-rw-r--r-- | fs/gfs2/lops.c | 4 | ||||
-rw-r--r-- | fs/gfs2/main.c | 28 | ||||
-rw-r--r-- | fs/gfs2/meta_io.c | 46 | ||||
-rw-r--r-- | fs/gfs2/meta_io.h | 12 | ||||
-rw-r--r-- | fs/gfs2/ops_fstype.c | 6 | ||||
-rw-r--r-- | fs/gfs2/ops_inode.c | 113 | ||||
-rw-r--r-- | fs/gfs2/super.c | 32 | ||||
-rw-r--r-- | fs/gfs2/sys.c | 2 | ||||
-rw-r--r-- | fs/gfs2/util.c | 1 | ||||
-rw-r--r-- | fs/gfs2/util.h | 1 |
18 files changed, 140 insertions, 225 deletions
diff --git a/fs/gfs2/aops.c b/fs/gfs2/aops.c index 7b8da9415267..0c1d0b82dcf1 100644 --- a/fs/gfs2/aops.c +++ b/fs/gfs2/aops.c | |||
@@ -1061,8 +1061,8 @@ out: | |||
1061 | 1061 | ||
1062 | int gfs2_releasepage(struct page *page, gfp_t gfp_mask) | 1062 | int gfs2_releasepage(struct page *page, gfp_t gfp_mask) |
1063 | { | 1063 | { |
1064 | struct inode *aspace = page->mapping->host; | 1064 | struct address_space *mapping = page->mapping; |
1065 | struct gfs2_sbd *sdp = aspace->i_sb->s_fs_info; | 1065 | struct gfs2_sbd *sdp = gfs2_mapping2sbd(mapping); |
1066 | struct buffer_head *bh, *head; | 1066 | struct buffer_head *bh, *head; |
1067 | struct gfs2_bufdata *bd; | 1067 | struct gfs2_bufdata *bd; |
1068 | 1068 | ||
diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c index 6d47379e794b..583e823307ae 100644 --- a/fs/gfs2/bmap.c +++ b/fs/gfs2/bmap.c | |||
@@ -541,7 +541,7 @@ static int gfs2_bmap_alloc(struct inode *inode, const sector_t lblock, | |||
541 | *ptr++ = cpu_to_be64(bn++); | 541 | *ptr++ = cpu_to_be64(bn++); |
542 | break; | 542 | break; |
543 | } | 543 | } |
544 | } while (state != ALLOC_DATA); | 544 | } while ((state != ALLOC_DATA) || !dblock); |
545 | 545 | ||
546 | ip->i_height = height; | 546 | ip->i_height = height; |
547 | gfs2_add_inode_blocks(&ip->i_inode, alloced); | 547 | gfs2_add_inode_blocks(&ip->i_inode, alloced); |
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c index f42663325931..454d4b4eb36b 100644 --- a/fs/gfs2/glock.c +++ b/fs/gfs2/glock.c | |||
@@ -19,7 +19,6 @@ | |||
19 | #include <linux/list.h> | 19 | #include <linux/list.h> |
20 | #include <linux/wait.h> | 20 | #include <linux/wait.h> |
21 | #include <linux/module.h> | 21 | #include <linux/module.h> |
22 | #include <linux/rwsem.h> | ||
23 | #include <asm/uaccess.h> | 22 | #include <asm/uaccess.h> |
24 | #include <linux/seq_file.h> | 23 | #include <linux/seq_file.h> |
25 | #include <linux/debugfs.h> | 24 | #include <linux/debugfs.h> |
@@ -60,7 +59,6 @@ static int __dump_glock(struct seq_file *seq, const struct gfs2_glock *gl); | |||
60 | #define GLOCK_BUG_ON(gl,x) do { if (unlikely(x)) { __dump_glock(NULL, gl); BUG(); } } while(0) | 59 | #define GLOCK_BUG_ON(gl,x) do { if (unlikely(x)) { __dump_glock(NULL, gl); BUG(); } } while(0) |
61 | static void do_xmote(struct gfs2_glock *gl, struct gfs2_holder *gh, unsigned int target); | 60 | static void do_xmote(struct gfs2_glock *gl, struct gfs2_holder *gh, unsigned int target); |
62 | 61 | ||
63 | static DECLARE_RWSEM(gfs2_umount_flush_sem); | ||
64 | static struct dentry *gfs2_root; | 62 | static struct dentry *gfs2_root; |
65 | static struct workqueue_struct *glock_workqueue; | 63 | static struct workqueue_struct *glock_workqueue; |
66 | struct workqueue_struct *gfs2_delete_workqueue; | 64 | struct workqueue_struct *gfs2_delete_workqueue; |
@@ -154,12 +152,14 @@ static unsigned int gl_hash(const struct gfs2_sbd *sdp, | |||
154 | static void glock_free(struct gfs2_glock *gl) | 152 | static void glock_free(struct gfs2_glock *gl) |
155 | { | 153 | { |
156 | struct gfs2_sbd *sdp = gl->gl_sbd; | 154 | struct gfs2_sbd *sdp = gl->gl_sbd; |
157 | struct inode *aspace = gl->gl_aspace; | 155 | struct address_space *mapping = gfs2_glock2aspace(gl); |
156 | struct kmem_cache *cachep = gfs2_glock_cachep; | ||
158 | 157 | ||
159 | if (aspace) | 158 | GLOCK_BUG_ON(gl, mapping && mapping->nrpages); |
160 | gfs2_aspace_put(aspace); | ||
161 | trace_gfs2_glock_put(gl); | 159 | trace_gfs2_glock_put(gl); |
162 | sdp->sd_lockstruct.ls_ops->lm_put_lock(gfs2_glock_cachep, gl); | 160 | if (mapping) |
161 | cachep = gfs2_glock_aspace_cachep; | ||
162 | sdp->sd_lockstruct.ls_ops->lm_put_lock(cachep, gl); | ||
163 | } | 163 | } |
164 | 164 | ||
165 | /** | 165 | /** |
@@ -712,7 +712,6 @@ static void glock_work_func(struct work_struct *work) | |||
712 | finish_xmote(gl, gl->gl_reply); | 712 | finish_xmote(gl, gl->gl_reply); |
713 | drop_ref = 1; | 713 | drop_ref = 1; |
714 | } | 714 | } |
715 | down_read(&gfs2_umount_flush_sem); | ||
716 | spin_lock(&gl->gl_spin); | 715 | spin_lock(&gl->gl_spin); |
717 | if (test_and_clear_bit(GLF_PENDING_DEMOTE, &gl->gl_flags) && | 716 | if (test_and_clear_bit(GLF_PENDING_DEMOTE, &gl->gl_flags) && |
718 | gl->gl_state != LM_ST_UNLOCKED && | 717 | gl->gl_state != LM_ST_UNLOCKED && |
@@ -725,7 +724,6 @@ static void glock_work_func(struct work_struct *work) | |||
725 | } | 724 | } |
726 | run_queue(gl, 0); | 725 | run_queue(gl, 0); |
727 | spin_unlock(&gl->gl_spin); | 726 | spin_unlock(&gl->gl_spin); |
728 | up_read(&gfs2_umount_flush_sem); | ||
729 | if (!delay || | 727 | if (!delay || |
730 | queue_delayed_work(glock_workqueue, &gl->gl_work, delay) == 0) | 728 | queue_delayed_work(glock_workqueue, &gl->gl_work, delay) == 0) |
731 | gfs2_glock_put(gl); | 729 | gfs2_glock_put(gl); |
@@ -750,10 +748,11 @@ int gfs2_glock_get(struct gfs2_sbd *sdp, u64 number, | |||
750 | const struct gfs2_glock_operations *glops, int create, | 748 | const struct gfs2_glock_operations *glops, int create, |
751 | struct gfs2_glock **glp) | 749 | struct gfs2_glock **glp) |
752 | { | 750 | { |
751 | struct super_block *s = sdp->sd_vfs; | ||
753 | struct lm_lockname name = { .ln_number = number, .ln_type = glops->go_type }; | 752 | struct lm_lockname name = { .ln_number = number, .ln_type = glops->go_type }; |
754 | struct gfs2_glock *gl, *tmp; | 753 | struct gfs2_glock *gl, *tmp; |
755 | unsigned int hash = gl_hash(sdp, &name); | 754 | unsigned int hash = gl_hash(sdp, &name); |
756 | int error; | 755 | struct address_space *mapping; |
757 | 756 | ||
758 | read_lock(gl_lock_addr(hash)); | 757 | read_lock(gl_lock_addr(hash)); |
759 | gl = search_bucket(hash, sdp, &name); | 758 | gl = search_bucket(hash, sdp, &name); |
@@ -765,7 +764,10 @@ int gfs2_glock_get(struct gfs2_sbd *sdp, u64 number, | |||
765 | if (!create) | 764 | if (!create) |
766 | return -ENOENT; | 765 | return -ENOENT; |
767 | 766 | ||
768 | gl = kmem_cache_alloc(gfs2_glock_cachep, GFP_KERNEL); | 767 | if (glops->go_flags & GLOF_ASPACE) |
768 | gl = kmem_cache_alloc(gfs2_glock_aspace_cachep, GFP_KERNEL); | ||
769 | else | ||
770 | gl = kmem_cache_alloc(gfs2_glock_cachep, GFP_KERNEL); | ||
769 | if (!gl) | 771 | if (!gl) |
770 | return -ENOMEM; | 772 | return -ENOMEM; |
771 | 773 | ||
@@ -784,18 +786,18 @@ int gfs2_glock_get(struct gfs2_sbd *sdp, u64 number, | |||
784 | gl->gl_tchange = jiffies; | 786 | gl->gl_tchange = jiffies; |
785 | gl->gl_object = NULL; | 787 | gl->gl_object = NULL; |
786 | gl->gl_sbd = sdp; | 788 | gl->gl_sbd = sdp; |
787 | gl->gl_aspace = NULL; | ||
788 | INIT_DELAYED_WORK(&gl->gl_work, glock_work_func); | 789 | INIT_DELAYED_WORK(&gl->gl_work, glock_work_func); |
789 | INIT_WORK(&gl->gl_delete, delete_work_func); | 790 | INIT_WORK(&gl->gl_delete, delete_work_func); |
790 | 791 | ||
791 | /* If this glock protects actual on-disk data or metadata blocks, | 792 | mapping = gfs2_glock2aspace(gl); |
792 | create a VFS inode to manage the pages/buffers holding them. */ | 793 | if (mapping) { |
793 | if (glops == &gfs2_inode_glops || glops == &gfs2_rgrp_glops) { | 794 | mapping->a_ops = &gfs2_meta_aops; |
794 | gl->gl_aspace = gfs2_aspace_get(sdp); | 795 | mapping->host = s->s_bdev->bd_inode; |
795 | if (!gl->gl_aspace) { | 796 | mapping->flags = 0; |
796 | error = -ENOMEM; | 797 | mapping_set_gfp_mask(mapping, GFP_NOFS); |
797 | goto fail; | 798 | mapping->assoc_mapping = NULL; |
798 | } | 799 | mapping->backing_dev_info = s->s_bdi; |
800 | mapping->writeback_index = 0; | ||
799 | } | 801 | } |
800 | 802 | ||
801 | write_lock(gl_lock_addr(hash)); | 803 | write_lock(gl_lock_addr(hash)); |
@@ -812,10 +814,6 @@ int gfs2_glock_get(struct gfs2_sbd *sdp, u64 number, | |||
812 | *glp = gl; | 814 | *glp = gl; |
813 | 815 | ||
814 | return 0; | 816 | return 0; |
815 | |||
816 | fail: | ||
817 | kmem_cache_free(gfs2_glock_cachep, gl); | ||
818 | return error; | ||
819 | } | 817 | } |
820 | 818 | ||
821 | /** | 819 | /** |
@@ -1510,35 +1508,10 @@ void gfs2_glock_thaw(struct gfs2_sbd *sdp) | |||
1510 | 1508 | ||
1511 | void gfs2_gl_hash_clear(struct gfs2_sbd *sdp) | 1509 | void gfs2_gl_hash_clear(struct gfs2_sbd *sdp) |
1512 | { | 1510 | { |
1513 | unsigned long t; | ||
1514 | unsigned int x; | 1511 | unsigned int x; |
1515 | int cont; | ||
1516 | 1512 | ||
1517 | t = jiffies; | 1513 | for (x = 0; x < GFS2_GL_HASH_SIZE; x++) |
1518 | 1514 | examine_bucket(clear_glock, sdp, x); | |
1519 | for (;;) { | ||
1520 | cont = 0; | ||
1521 | for (x = 0; x < GFS2_GL_HASH_SIZE; x++) { | ||
1522 | if (examine_bucket(clear_glock, sdp, x)) | ||
1523 | cont = 1; | ||
1524 | } | ||
1525 | |||
1526 | if (!cont) | ||
1527 | break; | ||
1528 | |||
1529 | if (time_after_eq(jiffies, | ||
1530 | t + gfs2_tune_get(sdp, gt_stall_secs) * HZ)) { | ||
1531 | fs_warn(sdp, "Unmount seems to be stalled. " | ||
1532 | "Dumping lock state...\n"); | ||
1533 | gfs2_dump_lockstate(sdp); | ||
1534 | t = jiffies; | ||
1535 | } | ||
1536 | |||
1537 | down_write(&gfs2_umount_flush_sem); | ||
1538 | invalidate_inodes(sdp->sd_vfs); | ||
1539 | up_write(&gfs2_umount_flush_sem); | ||
1540 | msleep(10); | ||
1541 | } | ||
1542 | flush_workqueue(glock_workqueue); | 1515 | flush_workqueue(glock_workqueue); |
1543 | wait_event(sdp->sd_glock_wait, atomic_read(&sdp->sd_glock_disposal) == 0); | 1516 | wait_event(sdp->sd_glock_wait, atomic_read(&sdp->sd_glock_disposal) == 0); |
1544 | gfs2_dump_lockstate(sdp); | 1517 | gfs2_dump_lockstate(sdp); |
@@ -1685,7 +1658,7 @@ static int __dump_glock(struct seq_file *seq, const struct gfs2_glock *gl) | |||
1685 | dtime *= 1000000/HZ; /* demote time in uSec */ | 1658 | dtime *= 1000000/HZ; /* demote time in uSec */ |
1686 | if (!test_bit(GLF_DEMOTE, &gl->gl_flags)) | 1659 | if (!test_bit(GLF_DEMOTE, &gl->gl_flags)) |
1687 | dtime = 0; | 1660 | dtime = 0; |
1688 | gfs2_print_dbg(seq, "G: s:%s n:%u/%llu f:%s t:%s d:%s/%llu a:%d r:%d\n", | 1661 | gfs2_print_dbg(seq, "G: s:%s n:%u/%llx f:%s t:%s d:%s/%llu a:%d r:%d\n", |
1689 | state2str(gl->gl_state), | 1662 | state2str(gl->gl_state), |
1690 | gl->gl_name.ln_type, | 1663 | gl->gl_name.ln_type, |
1691 | (unsigned long long)gl->gl_name.ln_number, | 1664 | (unsigned long long)gl->gl_name.ln_number, |
diff --git a/fs/gfs2/glock.h b/fs/gfs2/glock.h index c0262faf4725..2bda1911b156 100644 --- a/fs/gfs2/glock.h +++ b/fs/gfs2/glock.h | |||
@@ -180,6 +180,13 @@ static inline int gfs2_glock_is_held_shrd(struct gfs2_glock *gl) | |||
180 | return gl->gl_state == LM_ST_SHARED; | 180 | return gl->gl_state == LM_ST_SHARED; |
181 | } | 181 | } |
182 | 182 | ||
183 | static inline struct address_space *gfs2_glock2aspace(struct gfs2_glock *gl) | ||
184 | { | ||
185 | if (gl->gl_ops->go_flags & GLOF_ASPACE) | ||
186 | return (struct address_space *)(gl + 1); | ||
187 | return NULL; | ||
188 | } | ||
189 | |||
183 | int gfs2_glock_get(struct gfs2_sbd *sdp, | 190 | int gfs2_glock_get(struct gfs2_sbd *sdp, |
184 | u64 number, const struct gfs2_glock_operations *glops, | 191 | u64 number, const struct gfs2_glock_operations *glops, |
185 | int create, struct gfs2_glock **glp); | 192 | int create, struct gfs2_glock **glp); |
diff --git a/fs/gfs2/glops.c b/fs/gfs2/glops.c index 78554acc0605..38e3749d476c 100644 --- a/fs/gfs2/glops.c +++ b/fs/gfs2/glops.c | |||
@@ -87,7 +87,7 @@ static void gfs2_ail_empty_gl(struct gfs2_glock *gl) | |||
87 | 87 | ||
88 | static void rgrp_go_sync(struct gfs2_glock *gl) | 88 | static void rgrp_go_sync(struct gfs2_glock *gl) |
89 | { | 89 | { |
90 | struct address_space *metamapping = gl->gl_aspace->i_mapping; | 90 | struct address_space *metamapping = gfs2_glock2aspace(gl); |
91 | int error; | 91 | int error; |
92 | 92 | ||
93 | if (!test_and_clear_bit(GLF_DIRTY, &gl->gl_flags)) | 93 | if (!test_and_clear_bit(GLF_DIRTY, &gl->gl_flags)) |
@@ -113,7 +113,7 @@ static void rgrp_go_sync(struct gfs2_glock *gl) | |||
113 | 113 | ||
114 | static void rgrp_go_inval(struct gfs2_glock *gl, int flags) | 114 | static void rgrp_go_inval(struct gfs2_glock *gl, int flags) |
115 | { | 115 | { |
116 | struct address_space *mapping = gl->gl_aspace->i_mapping; | 116 | struct address_space *mapping = gfs2_glock2aspace(gl); |
117 | 117 | ||
118 | BUG_ON(!(flags & DIO_METADATA)); | 118 | BUG_ON(!(flags & DIO_METADATA)); |
119 | gfs2_assert_withdraw(gl->gl_sbd, !atomic_read(&gl->gl_ail_count)); | 119 | gfs2_assert_withdraw(gl->gl_sbd, !atomic_read(&gl->gl_ail_count)); |
@@ -134,7 +134,7 @@ static void rgrp_go_inval(struct gfs2_glock *gl, int flags) | |||
134 | static void inode_go_sync(struct gfs2_glock *gl) | 134 | static void inode_go_sync(struct gfs2_glock *gl) |
135 | { | 135 | { |
136 | struct gfs2_inode *ip = gl->gl_object; | 136 | struct gfs2_inode *ip = gl->gl_object; |
137 | struct address_space *metamapping = gl->gl_aspace->i_mapping; | 137 | struct address_space *metamapping = gfs2_glock2aspace(gl); |
138 | int error; | 138 | int error; |
139 | 139 | ||
140 | if (ip && !S_ISREG(ip->i_inode.i_mode)) | 140 | if (ip && !S_ISREG(ip->i_inode.i_mode)) |
@@ -183,7 +183,7 @@ static void inode_go_inval(struct gfs2_glock *gl, int flags) | |||
183 | gfs2_assert_withdraw(gl->gl_sbd, !atomic_read(&gl->gl_ail_count)); | 183 | gfs2_assert_withdraw(gl->gl_sbd, !atomic_read(&gl->gl_ail_count)); |
184 | 184 | ||
185 | if (flags & DIO_METADATA) { | 185 | if (flags & DIO_METADATA) { |
186 | struct address_space *mapping = gl->gl_aspace->i_mapping; | 186 | struct address_space *mapping = gfs2_glock2aspace(gl); |
187 | truncate_inode_pages(mapping, 0); | 187 | truncate_inode_pages(mapping, 0); |
188 | if (ip) { | 188 | if (ip) { |
189 | set_bit(GIF_INVALID, &ip->i_flags); | 189 | set_bit(GIF_INVALID, &ip->i_flags); |
@@ -282,7 +282,8 @@ static int inode_go_dump(struct seq_file *seq, const struct gfs2_glock *gl) | |||
282 | 282 | ||
283 | static int rgrp_go_demote_ok(const struct gfs2_glock *gl) | 283 | static int rgrp_go_demote_ok(const struct gfs2_glock *gl) |
284 | { | 284 | { |
285 | return !gl->gl_aspace->i_mapping->nrpages; | 285 | const struct address_space *mapping = (const struct address_space *)(gl + 1); |
286 | return !mapping->nrpages; | ||
286 | } | 287 | } |
287 | 288 | ||
288 | /** | 289 | /** |
@@ -387,8 +388,7 @@ static void iopen_go_callback(struct gfs2_glock *gl) | |||
387 | struct gfs2_inode *ip = (struct gfs2_inode *)gl->gl_object; | 388 | struct gfs2_inode *ip = (struct gfs2_inode *)gl->gl_object; |
388 | 389 | ||
389 | if (gl->gl_demote_state == LM_ST_UNLOCKED && | 390 | if (gl->gl_demote_state == LM_ST_UNLOCKED && |
390 | gl->gl_state == LM_ST_SHARED && | 391 | gl->gl_state == LM_ST_SHARED && ip) { |
391 | ip && test_bit(GIF_USER, &ip->i_flags)) { | ||
392 | gfs2_glock_hold(gl); | 392 | gfs2_glock_hold(gl); |
393 | if (queue_work(gfs2_delete_workqueue, &gl->gl_delete) == 0) | 393 | if (queue_work(gfs2_delete_workqueue, &gl->gl_delete) == 0) |
394 | gfs2_glock_put_nolock(gl); | 394 | gfs2_glock_put_nolock(gl); |
@@ -407,6 +407,7 @@ const struct gfs2_glock_operations gfs2_inode_glops = { | |||
407 | .go_dump = inode_go_dump, | 407 | .go_dump = inode_go_dump, |
408 | .go_type = LM_TYPE_INODE, | 408 | .go_type = LM_TYPE_INODE, |
409 | .go_min_hold_time = HZ / 5, | 409 | .go_min_hold_time = HZ / 5, |
410 | .go_flags = GLOF_ASPACE, | ||
410 | }; | 411 | }; |
411 | 412 | ||
412 | const struct gfs2_glock_operations gfs2_rgrp_glops = { | 413 | const struct gfs2_glock_operations gfs2_rgrp_glops = { |
@@ -418,6 +419,7 @@ const struct gfs2_glock_operations gfs2_rgrp_glops = { | |||
418 | .go_dump = gfs2_rgrp_dump, | 419 | .go_dump = gfs2_rgrp_dump, |
419 | .go_type = LM_TYPE_RGRP, | 420 | .go_type = LM_TYPE_RGRP, |
420 | .go_min_hold_time = HZ / 5, | 421 | .go_min_hold_time = HZ / 5, |
422 | .go_flags = GLOF_ASPACE, | ||
421 | }; | 423 | }; |
422 | 424 | ||
423 | const struct gfs2_glock_operations gfs2_trans_glops = { | 425 | const struct gfs2_glock_operations gfs2_trans_glops = { |
diff --git a/fs/gfs2/incore.h b/fs/gfs2/incore.h index bc0ad158e6b4..b8025e51cabf 100644 --- a/fs/gfs2/incore.h +++ b/fs/gfs2/incore.h | |||
@@ -162,6 +162,8 @@ struct gfs2_glock_operations { | |||
162 | void (*go_callback) (struct gfs2_glock *gl); | 162 | void (*go_callback) (struct gfs2_glock *gl); |
163 | const int go_type; | 163 | const int go_type; |
164 | const unsigned long go_min_hold_time; | 164 | const unsigned long go_min_hold_time; |
165 | const unsigned long go_flags; | ||
166 | #define GLOF_ASPACE 1 | ||
165 | }; | 167 | }; |
166 | 168 | ||
167 | enum { | 169 | enum { |
@@ -225,7 +227,6 @@ struct gfs2_glock { | |||
225 | 227 | ||
226 | struct gfs2_sbd *gl_sbd; | 228 | struct gfs2_sbd *gl_sbd; |
227 | 229 | ||
228 | struct inode *gl_aspace; | ||
229 | struct list_head gl_ail_list; | 230 | struct list_head gl_ail_list; |
230 | atomic_t gl_ail_count; | 231 | atomic_t gl_ail_count; |
231 | struct delayed_work gl_work; | 232 | struct delayed_work gl_work; |
@@ -258,7 +259,6 @@ enum { | |||
258 | GIF_INVALID = 0, | 259 | GIF_INVALID = 0, |
259 | GIF_QD_LOCKED = 1, | 260 | GIF_QD_LOCKED = 1, |
260 | GIF_SW_PAGED = 3, | 261 | GIF_SW_PAGED = 3, |
261 | GIF_USER = 4, /* user inode, not metadata addr space */ | ||
262 | }; | 262 | }; |
263 | 263 | ||
264 | 264 | ||
@@ -451,7 +451,6 @@ struct gfs2_tune { | |||
451 | unsigned int gt_quota_quantum; /* Secs between syncs to quota file */ | 451 | unsigned int gt_quota_quantum; /* Secs between syncs to quota file */ |
452 | unsigned int gt_new_files_jdata; | 452 | unsigned int gt_new_files_jdata; |
453 | unsigned int gt_max_readahead; /* Max bytes to read-ahead from disk */ | 453 | unsigned int gt_max_readahead; /* Max bytes to read-ahead from disk */ |
454 | unsigned int gt_stall_secs; /* Detects trouble! */ | ||
455 | unsigned int gt_complain_secs; | 454 | unsigned int gt_complain_secs; |
456 | unsigned int gt_statfs_quantum; | 455 | unsigned int gt_statfs_quantum; |
457 | unsigned int gt_statfs_slow; | 456 | unsigned int gt_statfs_slow; |
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c index 6e220f4eee7d..b1bf2694fb2b 100644 --- a/fs/gfs2/inode.c +++ b/fs/gfs2/inode.c | |||
@@ -45,7 +45,7 @@ static int iget_test(struct inode *inode, void *opaque) | |||
45 | struct gfs2_inode *ip = GFS2_I(inode); | 45 | struct gfs2_inode *ip = GFS2_I(inode); |
46 | u64 *no_addr = opaque; | 46 | u64 *no_addr = opaque; |
47 | 47 | ||
48 | if (ip->i_no_addr == *no_addr && test_bit(GIF_USER, &ip->i_flags)) | 48 | if (ip->i_no_addr == *no_addr) |
49 | return 1; | 49 | return 1; |
50 | 50 | ||
51 | return 0; | 51 | return 0; |
@@ -58,7 +58,6 @@ static int iget_set(struct inode *inode, void *opaque) | |||
58 | 58 | ||
59 | inode->i_ino = (unsigned long)*no_addr; | 59 | inode->i_ino = (unsigned long)*no_addr; |
60 | ip->i_no_addr = *no_addr; | 60 | ip->i_no_addr = *no_addr; |
61 | set_bit(GIF_USER, &ip->i_flags); | ||
62 | return 0; | 61 | return 0; |
63 | } | 62 | } |
64 | 63 | ||
@@ -84,7 +83,7 @@ static int iget_skip_test(struct inode *inode, void *opaque) | |||
84 | struct gfs2_inode *ip = GFS2_I(inode); | 83 | struct gfs2_inode *ip = GFS2_I(inode); |
85 | struct gfs2_skip_data *data = opaque; | 84 | struct gfs2_skip_data *data = opaque; |
86 | 85 | ||
87 | if (ip->i_no_addr == data->no_addr && test_bit(GIF_USER, &ip->i_flags)){ | 86 | if (ip->i_no_addr == data->no_addr) { |
88 | if (inode->i_state & (I_FREEING|I_CLEAR|I_WILL_FREE)){ | 87 | if (inode->i_state & (I_FREEING|I_CLEAR|I_WILL_FREE)){ |
89 | data->skipped = 1; | 88 | data->skipped = 1; |
90 | return 0; | 89 | return 0; |
@@ -103,7 +102,6 @@ static int iget_skip_set(struct inode *inode, void *opaque) | |||
103 | return 1; | 102 | return 1; |
104 | inode->i_ino = (unsigned long)(data->no_addr); | 103 | inode->i_ino = (unsigned long)(data->no_addr); |
105 | ip->i_no_addr = data->no_addr; | 104 | ip->i_no_addr = data->no_addr; |
106 | set_bit(GIF_USER, &ip->i_flags); | ||
107 | return 0; | 105 | return 0; |
108 | } | 106 | } |
109 | 107 | ||
diff --git a/fs/gfs2/lock_dlm.c b/fs/gfs2/lock_dlm.c index 0e5e0e7022e5..569b46240f61 100644 --- a/fs/gfs2/lock_dlm.c +++ b/fs/gfs2/lock_dlm.c | |||
@@ -30,7 +30,10 @@ static void gdlm_ast(void *arg) | |||
30 | 30 | ||
31 | switch (gl->gl_lksb.sb_status) { | 31 | switch (gl->gl_lksb.sb_status) { |
32 | case -DLM_EUNLOCK: /* Unlocked, so glock can be freed */ | 32 | case -DLM_EUNLOCK: /* Unlocked, so glock can be freed */ |
33 | kmem_cache_free(gfs2_glock_cachep, gl); | 33 | if (gl->gl_ops->go_flags & GLOF_ASPACE) |
34 | kmem_cache_free(gfs2_glock_aspace_cachep, gl); | ||
35 | else | ||
36 | kmem_cache_free(gfs2_glock_cachep, gl); | ||
34 | if (atomic_dec_and_test(&sdp->sd_glock_disposal)) | 37 | if (atomic_dec_and_test(&sdp->sd_glock_disposal)) |
35 | wake_up(&sdp->sd_glock_wait); | 38 | wake_up(&sdp->sd_glock_wait); |
36 | return; | 39 | return; |
diff --git a/fs/gfs2/lops.c b/fs/gfs2/lops.c index de97632ba32f..adc260fbea90 100644 --- a/fs/gfs2/lops.c +++ b/fs/gfs2/lops.c | |||
@@ -528,9 +528,9 @@ static void databuf_lo_add(struct gfs2_sbd *sdp, struct gfs2_log_element *le) | |||
528 | gfs2_pin(sdp, bd->bd_bh); | 528 | gfs2_pin(sdp, bd->bd_bh); |
529 | tr->tr_num_databuf_new++; | 529 | tr->tr_num_databuf_new++; |
530 | sdp->sd_log_num_databuf++; | 530 | sdp->sd_log_num_databuf++; |
531 | list_add(&le->le_list, &sdp->sd_log_le_databuf); | 531 | list_add_tail(&le->le_list, &sdp->sd_log_le_databuf); |
532 | } else { | 532 | } else { |
533 | list_add(&le->le_list, &sdp->sd_log_le_ordered); | 533 | list_add_tail(&le->le_list, &sdp->sd_log_le_ordered); |
534 | } | 534 | } |
535 | out: | 535 | out: |
536 | gfs2_log_unlock(sdp); | 536 | gfs2_log_unlock(sdp); |
diff --git a/fs/gfs2/main.c b/fs/gfs2/main.c index 5b31f7741a8f..a88fadc704bb 100644 --- a/fs/gfs2/main.c +++ b/fs/gfs2/main.c | |||
@@ -52,6 +52,22 @@ static void gfs2_init_glock_once(void *foo) | |||
52 | atomic_set(&gl->gl_ail_count, 0); | 52 | atomic_set(&gl->gl_ail_count, 0); |
53 | } | 53 | } |
54 | 54 | ||
55 | static void gfs2_init_gl_aspace_once(void *foo) | ||
56 | { | ||
57 | struct gfs2_glock *gl = foo; | ||
58 | struct address_space *mapping = (struct address_space *)(gl + 1); | ||
59 | |||
60 | gfs2_init_glock_once(gl); | ||
61 | memset(mapping, 0, sizeof(*mapping)); | ||
62 | INIT_RADIX_TREE(&mapping->page_tree, GFP_ATOMIC); | ||
63 | spin_lock_init(&mapping->tree_lock); | ||
64 | spin_lock_init(&mapping->i_mmap_lock); | ||
65 | INIT_LIST_HEAD(&mapping->private_list); | ||
66 | spin_lock_init(&mapping->private_lock); | ||
67 | INIT_RAW_PRIO_TREE_ROOT(&mapping->i_mmap); | ||
68 | INIT_LIST_HEAD(&mapping->i_mmap_nonlinear); | ||
69 | } | ||
70 | |||
55 | /** | 71 | /** |
56 | * init_gfs2_fs - Register GFS2 as a filesystem | 72 | * init_gfs2_fs - Register GFS2 as a filesystem |
57 | * | 73 | * |
@@ -78,6 +94,14 @@ static int __init init_gfs2_fs(void) | |||
78 | if (!gfs2_glock_cachep) | 94 | if (!gfs2_glock_cachep) |
79 | goto fail; | 95 | goto fail; |
80 | 96 | ||
97 | gfs2_glock_aspace_cachep = kmem_cache_create("gfs2_glock (aspace)", | ||
98 | sizeof(struct gfs2_glock) + | ||
99 | sizeof(struct address_space), | ||
100 | 0, 0, gfs2_init_gl_aspace_once); | ||
101 | |||
102 | if (!gfs2_glock_aspace_cachep) | ||
103 | goto fail; | ||
104 | |||
81 | gfs2_inode_cachep = kmem_cache_create("gfs2_inode", | 105 | gfs2_inode_cachep = kmem_cache_create("gfs2_inode", |
82 | sizeof(struct gfs2_inode), | 106 | sizeof(struct gfs2_inode), |
83 | 0, SLAB_RECLAIM_ACCOUNT| | 107 | 0, SLAB_RECLAIM_ACCOUNT| |
@@ -144,6 +168,9 @@ fail: | |||
144 | if (gfs2_inode_cachep) | 168 | if (gfs2_inode_cachep) |
145 | kmem_cache_destroy(gfs2_inode_cachep); | 169 | kmem_cache_destroy(gfs2_inode_cachep); |
146 | 170 | ||
171 | if (gfs2_glock_aspace_cachep) | ||
172 | kmem_cache_destroy(gfs2_glock_aspace_cachep); | ||
173 | |||
147 | if (gfs2_glock_cachep) | 174 | if (gfs2_glock_cachep) |
148 | kmem_cache_destroy(gfs2_glock_cachep); | 175 | kmem_cache_destroy(gfs2_glock_cachep); |
149 | 176 | ||
@@ -169,6 +196,7 @@ static void __exit exit_gfs2_fs(void) | |||
169 | kmem_cache_destroy(gfs2_rgrpd_cachep); | 196 | kmem_cache_destroy(gfs2_rgrpd_cachep); |
170 | kmem_cache_destroy(gfs2_bufdata_cachep); | 197 | kmem_cache_destroy(gfs2_bufdata_cachep); |
171 | kmem_cache_destroy(gfs2_inode_cachep); | 198 | kmem_cache_destroy(gfs2_inode_cachep); |
199 | kmem_cache_destroy(gfs2_glock_aspace_cachep); | ||
172 | kmem_cache_destroy(gfs2_glock_cachep); | 200 | kmem_cache_destroy(gfs2_glock_cachep); |
173 | 201 | ||
174 | gfs2_sys_uninit(); | 202 | gfs2_sys_uninit(); |
diff --git a/fs/gfs2/meta_io.c b/fs/gfs2/meta_io.c index 6f68a5f18eb8..0bb12c80937a 100644 --- a/fs/gfs2/meta_io.c +++ b/fs/gfs2/meta_io.c | |||
@@ -93,49 +93,13 @@ static int gfs2_aspace_writepage(struct page *page, struct writeback_control *wb | |||
93 | return err; | 93 | return err; |
94 | } | 94 | } |
95 | 95 | ||
96 | static const struct address_space_operations aspace_aops = { | 96 | const struct address_space_operations gfs2_meta_aops = { |
97 | .writepage = gfs2_aspace_writepage, | 97 | .writepage = gfs2_aspace_writepage, |
98 | .releasepage = gfs2_releasepage, | 98 | .releasepage = gfs2_releasepage, |
99 | .sync_page = block_sync_page, | 99 | .sync_page = block_sync_page, |
100 | }; | 100 | }; |
101 | 101 | ||
102 | /** | 102 | /** |
103 | * gfs2_aspace_get - Create and initialize a struct inode structure | ||
104 | * @sdp: the filesystem the aspace is in | ||
105 | * | ||
106 | * Right now a struct inode is just a struct inode. Maybe Linux | ||
107 | * will supply a more lightweight address space construct (that works) | ||
108 | * in the future. | ||
109 | * | ||
110 | * Make sure pages/buffers in this aspace aren't in high memory. | ||
111 | * | ||
112 | * Returns: the aspace | ||
113 | */ | ||
114 | |||
115 | struct inode *gfs2_aspace_get(struct gfs2_sbd *sdp) | ||
116 | { | ||
117 | struct inode *aspace; | ||
118 | struct gfs2_inode *ip; | ||
119 | |||
120 | aspace = new_inode(sdp->sd_vfs); | ||
121 | if (aspace) { | ||
122 | mapping_set_gfp_mask(aspace->i_mapping, GFP_NOFS); | ||
123 | aspace->i_mapping->a_ops = &aspace_aops; | ||
124 | aspace->i_size = MAX_LFS_FILESIZE; | ||
125 | ip = GFS2_I(aspace); | ||
126 | clear_bit(GIF_USER, &ip->i_flags); | ||
127 | insert_inode_hash(aspace); | ||
128 | } | ||
129 | return aspace; | ||
130 | } | ||
131 | |||
132 | void gfs2_aspace_put(struct inode *aspace) | ||
133 | { | ||
134 | remove_inode_hash(aspace); | ||
135 | iput(aspace); | ||
136 | } | ||
137 | |||
138 | /** | ||
139 | * gfs2_meta_sync - Sync all buffers associated with a glock | 103 | * gfs2_meta_sync - Sync all buffers associated with a glock |
140 | * @gl: The glock | 104 | * @gl: The glock |
141 | * | 105 | * |
@@ -143,7 +107,7 @@ void gfs2_aspace_put(struct inode *aspace) | |||
143 | 107 | ||
144 | void gfs2_meta_sync(struct gfs2_glock *gl) | 108 | void gfs2_meta_sync(struct gfs2_glock *gl) |
145 | { | 109 | { |
146 | struct address_space *mapping = gl->gl_aspace->i_mapping; | 110 | struct address_space *mapping = gfs2_glock2aspace(gl); |
147 | int error; | 111 | int error; |
148 | 112 | ||
149 | filemap_fdatawrite(mapping); | 113 | filemap_fdatawrite(mapping); |
@@ -164,7 +128,7 @@ void gfs2_meta_sync(struct gfs2_glock *gl) | |||
164 | 128 | ||
165 | struct buffer_head *gfs2_getbuf(struct gfs2_glock *gl, u64 blkno, int create) | 129 | struct buffer_head *gfs2_getbuf(struct gfs2_glock *gl, u64 blkno, int create) |
166 | { | 130 | { |
167 | struct address_space *mapping = gl->gl_aspace->i_mapping; | 131 | struct address_space *mapping = gfs2_glock2aspace(gl); |
168 | struct gfs2_sbd *sdp = gl->gl_sbd; | 132 | struct gfs2_sbd *sdp = gl->gl_sbd; |
169 | struct page *page; | 133 | struct page *page; |
170 | struct buffer_head *bh; | 134 | struct buffer_head *bh; |
@@ -344,8 +308,10 @@ void gfs2_attach_bufdata(struct gfs2_glock *gl, struct buffer_head *bh, | |||
344 | 308 | ||
345 | void gfs2_remove_from_journal(struct buffer_head *bh, struct gfs2_trans *tr, int meta) | 309 | void gfs2_remove_from_journal(struct buffer_head *bh, struct gfs2_trans *tr, int meta) |
346 | { | 310 | { |
347 | struct gfs2_sbd *sdp = GFS2_SB(bh->b_page->mapping->host); | 311 | struct address_space *mapping = bh->b_page->mapping; |
312 | struct gfs2_sbd *sdp = gfs2_mapping2sbd(mapping); | ||
348 | struct gfs2_bufdata *bd = bh->b_private; | 313 | struct gfs2_bufdata *bd = bh->b_private; |
314 | |||
349 | if (test_clear_buffer_pinned(bh)) { | 315 | if (test_clear_buffer_pinned(bh)) { |
350 | list_del_init(&bd->bd_le.le_list); | 316 | list_del_init(&bd->bd_le.le_list); |
351 | if (meta) { | 317 | if (meta) { |
diff --git a/fs/gfs2/meta_io.h b/fs/gfs2/meta_io.h index de270c2f9b63..6a1d9ba16411 100644 --- a/fs/gfs2/meta_io.h +++ b/fs/gfs2/meta_io.h | |||
@@ -37,8 +37,16 @@ static inline void gfs2_buffer_copy_tail(struct buffer_head *to_bh, | |||
37 | 0, from_head - to_head); | 37 | 0, from_head - to_head); |
38 | } | 38 | } |
39 | 39 | ||
40 | struct inode *gfs2_aspace_get(struct gfs2_sbd *sdp); | 40 | extern const struct address_space_operations gfs2_meta_aops; |
41 | void gfs2_aspace_put(struct inode *aspace); | 41 | |
42 | static inline struct gfs2_sbd *gfs2_mapping2sbd(struct address_space *mapping) | ||
43 | { | ||
44 | struct inode *inode = mapping->host; | ||
45 | if (mapping->a_ops == &gfs2_meta_aops) | ||
46 | return (((struct gfs2_glock *)mapping) - 1)->gl_sbd; | ||
47 | else | ||
48 | return inode->i_sb->s_fs_info; | ||
49 | } | ||
42 | 50 | ||
43 | void gfs2_meta_sync(struct gfs2_glock *gl); | 51 | void gfs2_meta_sync(struct gfs2_glock *gl); |
44 | 52 | ||
diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c index 8a102f731003..a054b526dc08 100644 --- a/fs/gfs2/ops_fstype.c +++ b/fs/gfs2/ops_fstype.c | |||
@@ -65,7 +65,6 @@ static void gfs2_tune_init(struct gfs2_tune *gt) | |||
65 | gt->gt_quota_scale_den = 1; | 65 | gt->gt_quota_scale_den = 1; |
66 | gt->gt_new_files_jdata = 0; | 66 | gt->gt_new_files_jdata = 0; |
67 | gt->gt_max_readahead = 1 << 18; | 67 | gt->gt_max_readahead = 1 << 18; |
68 | gt->gt_stall_secs = 600; | ||
69 | gt->gt_complain_secs = 10; | 68 | gt->gt_complain_secs = 10; |
70 | } | 69 | } |
71 | 70 | ||
@@ -725,7 +724,7 @@ static int init_journal(struct gfs2_sbd *sdp, int undo) | |||
725 | goto fail; | 724 | goto fail; |
726 | } | 725 | } |
727 | 726 | ||
728 | error = -EINVAL; | 727 | error = -EUSERS; |
729 | if (!gfs2_jindex_size(sdp)) { | 728 | if (!gfs2_jindex_size(sdp)) { |
730 | fs_err(sdp, "no journals!\n"); | 729 | fs_err(sdp, "no journals!\n"); |
731 | goto fail_jindex; | 730 | goto fail_jindex; |
@@ -1241,10 +1240,9 @@ fail_sb: | |||
1241 | fail_locking: | 1240 | fail_locking: |
1242 | init_locking(sdp, &mount_gh, UNDO); | 1241 | init_locking(sdp, &mount_gh, UNDO); |
1243 | fail_lm: | 1242 | fail_lm: |
1243 | invalidate_inodes(sb); | ||
1244 | gfs2_gl_hash_clear(sdp); | 1244 | gfs2_gl_hash_clear(sdp); |
1245 | gfs2_lm_unmount(sdp); | 1245 | gfs2_lm_unmount(sdp); |
1246 | while (invalidate_inodes(sb)) | ||
1247 | yield(); | ||
1248 | fail_sys: | 1246 | fail_sys: |
1249 | gfs2_sys_fs_del(sdp); | 1247 | gfs2_sys_fs_del(sdp); |
1250 | fail: | 1248 | fail: |
diff --git a/fs/gfs2/ops_inode.c b/fs/gfs2/ops_inode.c index 84350e1be66d..4e64352d49de 100644 --- a/fs/gfs2/ops_inode.c +++ b/fs/gfs2/ops_inode.c | |||
@@ -976,122 +976,62 @@ out: | |||
976 | } | 976 | } |
977 | 977 | ||
978 | /** | 978 | /** |
979 | * gfs2_readlinki - return the contents of a symlink | 979 | * gfs2_follow_link - Follow a symbolic link |
980 | * @ip: the symlink's inode | 980 | * @dentry: The dentry of the link |
981 | * @buf: a pointer to the buffer to be filled | 981 | * @nd: Data that we pass to vfs_follow_link() |
982 | * @len: a pointer to the length of @buf | ||
983 | * | 982 | * |
984 | * If @buf is too small, a piece of memory is kmalloc()ed and needs | 983 | * This can handle symlinks of any size. |
985 | * to be freed by the caller. | ||
986 | * | 984 | * |
987 | * Returns: errno | 985 | * Returns: 0 on success or error code |
988 | */ | 986 | */ |
989 | 987 | ||
990 | static int gfs2_readlinki(struct gfs2_inode *ip, char **buf, unsigned int *len) | 988 | static void *gfs2_follow_link(struct dentry *dentry, struct nameidata *nd) |
991 | { | 989 | { |
990 | struct gfs2_inode *ip = GFS2_I(dentry->d_inode); | ||
992 | struct gfs2_holder i_gh; | 991 | struct gfs2_holder i_gh; |
993 | struct buffer_head *dibh; | 992 | struct buffer_head *dibh; |
994 | unsigned int x; | 993 | unsigned int x; |
994 | char *buf; | ||
995 | int error; | 995 | int error; |
996 | 996 | ||
997 | gfs2_holder_init(ip->i_gl, LM_ST_SHARED, 0, &i_gh); | 997 | gfs2_holder_init(ip->i_gl, LM_ST_SHARED, 0, &i_gh); |
998 | error = gfs2_glock_nq(&i_gh); | 998 | error = gfs2_glock_nq(&i_gh); |
999 | if (error) { | 999 | if (error) { |
1000 | gfs2_holder_uninit(&i_gh); | 1000 | gfs2_holder_uninit(&i_gh); |
1001 | return error; | 1001 | nd_set_link(nd, ERR_PTR(error)); |
1002 | return NULL; | ||
1002 | } | 1003 | } |
1003 | 1004 | ||
1004 | if (!ip->i_disksize) { | 1005 | if (!ip->i_disksize) { |
1005 | gfs2_consist_inode(ip); | 1006 | gfs2_consist_inode(ip); |
1006 | error = -EIO; | 1007 | buf = ERR_PTR(-EIO); |
1007 | goto out; | 1008 | goto out; |
1008 | } | 1009 | } |
1009 | 1010 | ||
1010 | error = gfs2_meta_inode_buffer(ip, &dibh); | 1011 | error = gfs2_meta_inode_buffer(ip, &dibh); |
1011 | if (error) | 1012 | if (error) { |
1013 | buf = ERR_PTR(error); | ||
1012 | goto out; | 1014 | goto out; |
1013 | |||
1014 | x = ip->i_disksize + 1; | ||
1015 | if (x > *len) { | ||
1016 | *buf = kmalloc(x, GFP_NOFS); | ||
1017 | if (!*buf) { | ||
1018 | error = -ENOMEM; | ||
1019 | goto out_brelse; | ||
1020 | } | ||
1021 | } | 1015 | } |
1022 | 1016 | ||
1023 | memcpy(*buf, dibh->b_data + sizeof(struct gfs2_dinode), x); | 1017 | x = ip->i_disksize + 1; |
1024 | *len = x; | 1018 | buf = kmalloc(x, GFP_NOFS); |
1025 | 1019 | if (!buf) | |
1026 | out_brelse: | 1020 | buf = ERR_PTR(-ENOMEM); |
1021 | else | ||
1022 | memcpy(buf, dibh->b_data + sizeof(struct gfs2_dinode), x); | ||
1027 | brelse(dibh); | 1023 | brelse(dibh); |
1028 | out: | 1024 | out: |
1029 | gfs2_glock_dq_uninit(&i_gh); | 1025 | gfs2_glock_dq_uninit(&i_gh); |
1030 | return error; | 1026 | nd_set_link(nd, buf); |
1031 | } | 1027 | return NULL; |
1032 | |||
1033 | /** | ||
1034 | * gfs2_readlink - Read the value of a symlink | ||
1035 | * @dentry: the symlink | ||
1036 | * @buf: the buffer to read the symlink data into | ||
1037 | * @size: the size of the buffer | ||
1038 | * | ||
1039 | * Returns: errno | ||
1040 | */ | ||
1041 | |||
1042 | static int gfs2_readlink(struct dentry *dentry, char __user *user_buf, | ||
1043 | int user_size) | ||
1044 | { | ||
1045 | struct gfs2_inode *ip = GFS2_I(dentry->d_inode); | ||
1046 | char array[GFS2_FAST_NAME_SIZE], *buf = array; | ||
1047 | unsigned int len = GFS2_FAST_NAME_SIZE; | ||
1048 | int error; | ||
1049 | |||
1050 | error = gfs2_readlinki(ip, &buf, &len); | ||
1051 | if (error) | ||
1052 | return error; | ||
1053 | |||
1054 | if (user_size > len - 1) | ||
1055 | user_size = len - 1; | ||
1056 | |||
1057 | if (copy_to_user(user_buf, buf, user_size)) | ||
1058 | error = -EFAULT; | ||
1059 | else | ||
1060 | error = user_size; | ||
1061 | |||
1062 | if (buf != array) | ||
1063 | kfree(buf); | ||
1064 | |||
1065 | return error; | ||
1066 | } | 1028 | } |
1067 | 1029 | ||
1068 | /** | 1030 | static void gfs2_put_link(struct dentry *dentry, struct nameidata *nd, void *p) |
1069 | * gfs2_follow_link - Follow a symbolic link | ||
1070 | * @dentry: The dentry of the link | ||
1071 | * @nd: Data that we pass to vfs_follow_link() | ||
1072 | * | ||
1073 | * This can handle symlinks of any size. It is optimised for symlinks | ||
1074 | * under GFS2_FAST_NAME_SIZE. | ||
1075 | * | ||
1076 | * Returns: 0 on success or error code | ||
1077 | */ | ||
1078 | |||
1079 | static void *gfs2_follow_link(struct dentry *dentry, struct nameidata *nd) | ||
1080 | { | 1031 | { |
1081 | struct gfs2_inode *ip = GFS2_I(dentry->d_inode); | 1032 | char *s = nd_get_link(nd); |
1082 | char array[GFS2_FAST_NAME_SIZE], *buf = array; | 1033 | if (!IS_ERR(s)) |
1083 | unsigned int len = GFS2_FAST_NAME_SIZE; | 1034 | kfree(s); |
1084 | int error; | ||
1085 | |||
1086 | error = gfs2_readlinki(ip, &buf, &len); | ||
1087 | if (!error) { | ||
1088 | error = vfs_follow_link(nd, buf); | ||
1089 | if (buf != array) | ||
1090 | kfree(buf); | ||
1091 | } else | ||
1092 | path_put(&nd->path); | ||
1093 | |||
1094 | return ERR_PTR(error); | ||
1095 | } | 1035 | } |
1096 | 1036 | ||
1097 | /** | 1037 | /** |
@@ -1426,8 +1366,9 @@ const struct inode_operations gfs2_dir_iops = { | |||
1426 | }; | 1366 | }; |
1427 | 1367 | ||
1428 | const struct inode_operations gfs2_symlink_iops = { | 1368 | const struct inode_operations gfs2_symlink_iops = { |
1429 | .readlink = gfs2_readlink, | 1369 | .readlink = generic_readlink, |
1430 | .follow_link = gfs2_follow_link, | 1370 | .follow_link = gfs2_follow_link, |
1371 | .put_link = gfs2_put_link, | ||
1431 | .permission = gfs2_permission, | 1372 | .permission = gfs2_permission, |
1432 | .setattr = gfs2_setattr, | 1373 | .setattr = gfs2_setattr, |
1433 | .getattr = gfs2_getattr, | 1374 | .getattr = gfs2_getattr, |
diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c index b9dd3da22c0a..ca87598ead7f 100644 --- a/fs/gfs2/super.c +++ b/fs/gfs2/super.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/crc32.h> | 22 | #include <linux/crc32.h> |
23 | #include <linux/time.h> | 23 | #include <linux/time.h> |
24 | #include <linux/wait.h> | 24 | #include <linux/wait.h> |
25 | #include <linux/writeback.h> | ||
25 | 26 | ||
26 | #include "gfs2.h" | 27 | #include "gfs2.h" |
27 | #include "incore.h" | 28 | #include "incore.h" |
@@ -711,7 +712,7 @@ void gfs2_unfreeze_fs(struct gfs2_sbd *sdp) | |||
711 | * Returns: errno | 712 | * Returns: errno |
712 | */ | 713 | */ |
713 | 714 | ||
714 | static int gfs2_write_inode(struct inode *inode, int sync) | 715 | static int gfs2_write_inode(struct inode *inode, struct writeback_control *wbc) |
715 | { | 716 | { |
716 | struct gfs2_inode *ip = GFS2_I(inode); | 717 | struct gfs2_inode *ip = GFS2_I(inode); |
717 | struct gfs2_sbd *sdp = GFS2_SB(inode); | 718 | struct gfs2_sbd *sdp = GFS2_SB(inode); |
@@ -722,8 +723,7 @@ static int gfs2_write_inode(struct inode *inode, int sync) | |||
722 | int ret = 0; | 723 | int ret = 0; |
723 | 724 | ||
724 | /* Check this is a "normal" inode, etc */ | 725 | /* Check this is a "normal" inode, etc */ |
725 | if (!test_bit(GIF_USER, &ip->i_flags) || | 726 | if (current->flags & PF_MEMALLOC) |
726 | (current->flags & PF_MEMALLOC)) | ||
727 | return 0; | 727 | return 0; |
728 | ret = gfs2_glock_nq_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &gh); | 728 | ret = gfs2_glock_nq_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &gh); |
729 | if (ret) | 729 | if (ret) |
@@ -746,7 +746,7 @@ static int gfs2_write_inode(struct inode *inode, int sync) | |||
746 | do_unlock: | 746 | do_unlock: |
747 | gfs2_glock_dq_uninit(&gh); | 747 | gfs2_glock_dq_uninit(&gh); |
748 | do_flush: | 748 | do_flush: |
749 | if (sync != 0) | 749 | if (wbc->sync_mode == WB_SYNC_ALL) |
750 | gfs2_log_flush(GFS2_SB(inode), ip->i_gl); | 750 | gfs2_log_flush(GFS2_SB(inode), ip->i_gl); |
751 | return ret; | 751 | return ret; |
752 | } | 752 | } |
@@ -860,6 +860,7 @@ restart: | |||
860 | gfs2_clear_rgrpd(sdp); | 860 | gfs2_clear_rgrpd(sdp); |
861 | gfs2_jindex_free(sdp); | 861 | gfs2_jindex_free(sdp); |
862 | /* Take apart glock structures and buffer lists */ | 862 | /* Take apart glock structures and buffer lists */ |
863 | invalidate_inodes(sdp->sd_vfs); | ||
863 | gfs2_gl_hash_clear(sdp); | 864 | gfs2_gl_hash_clear(sdp); |
864 | /* Unmount the locking protocol */ | 865 | /* Unmount the locking protocol */ |
865 | gfs2_lm_unmount(sdp); | 866 | gfs2_lm_unmount(sdp); |
@@ -1194,7 +1195,7 @@ static void gfs2_drop_inode(struct inode *inode) | |||
1194 | { | 1195 | { |
1195 | struct gfs2_inode *ip = GFS2_I(inode); | 1196 | struct gfs2_inode *ip = GFS2_I(inode); |
1196 | 1197 | ||
1197 | if (test_bit(GIF_USER, &ip->i_flags) && inode->i_nlink) { | 1198 | if (inode->i_nlink) { |
1198 | struct gfs2_glock *gl = ip->i_iopen_gh.gh_gl; | 1199 | struct gfs2_glock *gl = ip->i_iopen_gh.gh_gl; |
1199 | if (gl && test_bit(GLF_DEMOTE, &gl->gl_flags)) | 1200 | if (gl && test_bit(GLF_DEMOTE, &gl->gl_flags)) |
1200 | clear_nlink(inode); | 1201 | clear_nlink(inode); |
@@ -1212,18 +1213,12 @@ static void gfs2_clear_inode(struct inode *inode) | |||
1212 | { | 1213 | { |
1213 | struct gfs2_inode *ip = GFS2_I(inode); | 1214 | struct gfs2_inode *ip = GFS2_I(inode); |
1214 | 1215 | ||
1215 | /* This tells us its a "real" inode and not one which only | 1216 | ip->i_gl->gl_object = NULL; |
1216 | * serves to contain an address space (see rgrp.c, meta_io.c) | 1217 | gfs2_glock_put(ip->i_gl); |
1217 | * which therefore doesn't have its own glocks. | 1218 | ip->i_gl = NULL; |
1218 | */ | 1219 | if (ip->i_iopen_gh.gh_gl) { |
1219 | if (test_bit(GIF_USER, &ip->i_flags)) { | 1220 | ip->i_iopen_gh.gh_gl->gl_object = NULL; |
1220 | ip->i_gl->gl_object = NULL; | 1221 | gfs2_glock_dq_uninit(&ip->i_iopen_gh); |
1221 | gfs2_glock_put(ip->i_gl); | ||
1222 | ip->i_gl = NULL; | ||
1223 | if (ip->i_iopen_gh.gh_gl) { | ||
1224 | ip->i_iopen_gh.gh_gl->gl_object = NULL; | ||
1225 | gfs2_glock_dq_uninit(&ip->i_iopen_gh); | ||
1226 | } | ||
1227 | } | 1222 | } |
1228 | } | 1223 | } |
1229 | 1224 | ||
@@ -1358,9 +1353,6 @@ static void gfs2_delete_inode(struct inode *inode) | |||
1358 | struct gfs2_holder gh; | 1353 | struct gfs2_holder gh; |
1359 | int error; | 1354 | int error; |
1360 | 1355 | ||
1361 | if (!test_bit(GIF_USER, &ip->i_flags)) | ||
1362 | goto out; | ||
1363 | |||
1364 | error = gfs2_glock_nq_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &gh); | 1356 | error = gfs2_glock_nq_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &gh); |
1365 | if (unlikely(error)) { | 1357 | if (unlikely(error)) { |
1366 | gfs2_glock_dq_uninit(&ip->i_iopen_gh); | 1358 | gfs2_glock_dq_uninit(&ip->i_iopen_gh); |
diff --git a/fs/gfs2/sys.c b/fs/gfs2/sys.c index 0dc34621f6a6..a0db1c94317d 100644 --- a/fs/gfs2/sys.c +++ b/fs/gfs2/sys.c | |||
@@ -478,7 +478,6 @@ TUNE_ATTR(complain_secs, 0); | |||
478 | TUNE_ATTR(statfs_slow, 0); | 478 | TUNE_ATTR(statfs_slow, 0); |
479 | TUNE_ATTR(new_files_jdata, 0); | 479 | TUNE_ATTR(new_files_jdata, 0); |
480 | TUNE_ATTR(quota_simul_sync, 1); | 480 | TUNE_ATTR(quota_simul_sync, 1); |
481 | TUNE_ATTR(stall_secs, 1); | ||
482 | TUNE_ATTR(statfs_quantum, 1); | 481 | TUNE_ATTR(statfs_quantum, 1); |
483 | TUNE_ATTR_3(quota_scale, quota_scale_show, quota_scale_store); | 482 | TUNE_ATTR_3(quota_scale, quota_scale_show, quota_scale_store); |
484 | 483 | ||
@@ -491,7 +490,6 @@ static struct attribute *tune_attrs[] = { | |||
491 | &tune_attr_complain_secs.attr, | 490 | &tune_attr_complain_secs.attr, |
492 | &tune_attr_statfs_slow.attr, | 491 | &tune_attr_statfs_slow.attr, |
493 | &tune_attr_quota_simul_sync.attr, | 492 | &tune_attr_quota_simul_sync.attr, |
494 | &tune_attr_stall_secs.attr, | ||
495 | &tune_attr_statfs_quantum.attr, | 493 | &tune_attr_statfs_quantum.attr, |
496 | &tune_attr_quota_scale.attr, | 494 | &tune_attr_quota_scale.attr, |
497 | &tune_attr_new_files_jdata.attr, | 495 | &tune_attr_new_files_jdata.attr, |
diff --git a/fs/gfs2/util.c b/fs/gfs2/util.c index f6a7efa34eb9..226f2bfbf16a 100644 --- a/fs/gfs2/util.c +++ b/fs/gfs2/util.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include "util.h" | 21 | #include "util.h" |
22 | 22 | ||
23 | struct kmem_cache *gfs2_glock_cachep __read_mostly; | 23 | struct kmem_cache *gfs2_glock_cachep __read_mostly; |
24 | struct kmem_cache *gfs2_glock_aspace_cachep __read_mostly; | ||
24 | struct kmem_cache *gfs2_inode_cachep __read_mostly; | 25 | struct kmem_cache *gfs2_inode_cachep __read_mostly; |
25 | struct kmem_cache *gfs2_bufdata_cachep __read_mostly; | 26 | struct kmem_cache *gfs2_bufdata_cachep __read_mostly; |
26 | struct kmem_cache *gfs2_rgrpd_cachep __read_mostly; | 27 | struct kmem_cache *gfs2_rgrpd_cachep __read_mostly; |
diff --git a/fs/gfs2/util.h b/fs/gfs2/util.h index 33e96b0ce9ab..b432e04600de 100644 --- a/fs/gfs2/util.h +++ b/fs/gfs2/util.h | |||
@@ -145,6 +145,7 @@ gfs2_io_error_bh_i((sdp), (bh), __func__, __FILE__, __LINE__); | |||
145 | 145 | ||
146 | 146 | ||
147 | extern struct kmem_cache *gfs2_glock_cachep; | 147 | extern struct kmem_cache *gfs2_glock_cachep; |
148 | extern struct kmem_cache *gfs2_glock_aspace_cachep; | ||
148 | extern struct kmem_cache *gfs2_inode_cachep; | 149 | extern struct kmem_cache *gfs2_inode_cachep; |
149 | extern struct kmem_cache *gfs2_bufdata_cachep; | 150 | extern struct kmem_cache *gfs2_bufdata_cachep; |
150 | extern struct kmem_cache *gfs2_rgrpd_cachep; | 151 | extern struct kmem_cache *gfs2_rgrpd_cachep; |