diff options
Diffstat (limited to 'fs/gfs2/super.c')
-rw-r--r-- | fs/gfs2/super.c | 36 |
1 files changed, 22 insertions, 14 deletions
diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c index 2c1c6aa1c077..9ccf0b9c5980 100644 --- a/fs/gfs2/super.c +++ b/fs/gfs2/super.c | |||
@@ -12,9 +12,12 @@ | |||
12 | #include <linux/spinlock.h> | 12 | #include <linux/spinlock.h> |
13 | #include <linux/completion.h> | 13 | #include <linux/completion.h> |
14 | #include <linux/buffer_head.h> | 14 | #include <linux/buffer_head.h> |
15 | #include <linux/gfs2_ondisk.h> | ||
15 | #include <asm/semaphore.h> | 16 | #include <asm/semaphore.h> |
16 | 17 | ||
17 | #include "gfs2.h" | 18 | #include "gfs2.h" |
19 | #include "lm_interface.h" | ||
20 | #include "incore.h" | ||
18 | #include "bmap.h" | 21 | #include "bmap.h" |
19 | #include "dir.h" | 22 | #include "dir.h" |
20 | #include "format.h" | 23 | #include "format.h" |
@@ -29,6 +32,7 @@ | |||
29 | #include "super.h" | 32 | #include "super.h" |
30 | #include "trans.h" | 33 | #include "trans.h" |
31 | #include "unlinked.h" | 34 | #include "unlinked.h" |
35 | #include "util.h" | ||
32 | 36 | ||
33 | /** | 37 | /** |
34 | * gfs2_tune_init - Fill a gfs2_tune structure with default values | 38 | * gfs2_tune_init - Fill a gfs2_tune structure with default values |
@@ -207,12 +211,12 @@ int gfs2_read_sb(struct gfs2_sbd *sdp, struct gfs2_glock *gl, int silent) | |||
207 | 211 | ||
208 | /* Compute maximum reservation required to add a entry to a directory */ | 212 | /* Compute maximum reservation required to add a entry to a directory */ |
209 | 213 | ||
210 | hash_blocks = DIV_RU(sizeof(uint64_t) * (1 << GFS2_DIR_MAX_DEPTH), | 214 | hash_blocks = DIV_ROUND_UP(sizeof(uint64_t) * (1 << GFS2_DIR_MAX_DEPTH), |
211 | sdp->sd_jbsize); | 215 | sdp->sd_jbsize); |
212 | 216 | ||
213 | ind_blocks = 0; | 217 | ind_blocks = 0; |
214 | for (tmp_blocks = hash_blocks; tmp_blocks > sdp->sd_diptrs;) { | 218 | for (tmp_blocks = hash_blocks; tmp_blocks > sdp->sd_diptrs;) { |
215 | tmp_blocks = DIV_RU(tmp_blocks, sdp->sd_inptrs); | 219 | tmp_blocks = DIV_ROUND_UP(tmp_blocks, sdp->sd_inptrs); |
216 | ind_blocks += tmp_blocks; | 220 | ind_blocks += tmp_blocks; |
217 | } | 221 | } |
218 | 222 | ||
@@ -278,7 +282,7 @@ int gfs2_do_upgrade(struct gfs2_sbd *sdp, struct gfs2_glock *sb_gl) | |||
278 | 282 | ||
279 | int gfs2_jindex_hold(struct gfs2_sbd *sdp, struct gfs2_holder *ji_gh) | 283 | int gfs2_jindex_hold(struct gfs2_sbd *sdp, struct gfs2_holder *ji_gh) |
280 | { | 284 | { |
281 | struct gfs2_inode *dip = get_v2ip(sdp->sd_jindex); | 285 | struct gfs2_inode *dip = sdp->sd_jindex->u.generic_ip; |
282 | struct qstr name; | 286 | struct qstr name; |
283 | char buf[20]; | 287 | char buf[20]; |
284 | struct gfs2_jdesc *jd; | 288 | struct gfs2_jdesc *jd; |
@@ -296,7 +300,7 @@ int gfs2_jindex_hold(struct gfs2_sbd *sdp, struct gfs2_holder *ji_gh) | |||
296 | 300 | ||
297 | name.len = sprintf(buf, "journal%u", sdp->sd_journals); | 301 | name.len = sprintf(buf, "journal%u", sdp->sd_journals); |
298 | 302 | ||
299 | error = gfs2_dir_search(get_v2ip(sdp->sd_jindex), | 303 | error = gfs2_dir_search(sdp->sd_jindex->u.generic_ip, |
300 | &name, NULL, NULL); | 304 | &name, NULL, NULL); |
301 | if (error == -ENOENT) { | 305 | if (error == -ENOENT) { |
302 | error = 0; | 306 | error = 0; |
@@ -419,7 +423,7 @@ struct gfs2_jdesc *gfs2_jdesc_find_dirty(struct gfs2_sbd *sdp) | |||
419 | 423 | ||
420 | int gfs2_jdesc_check(struct gfs2_jdesc *jd) | 424 | int gfs2_jdesc_check(struct gfs2_jdesc *jd) |
421 | { | 425 | { |
422 | struct gfs2_inode *ip = get_v2ip(jd->jd_inode); | 426 | struct gfs2_inode *ip = jd->jd_inode->u.generic_ip; |
423 | struct gfs2_sbd *sdp = ip->i_sbd; | 427 | struct gfs2_sbd *sdp = ip->i_sbd; |
424 | int ar; | 428 | int ar; |
425 | int error; | 429 | int error; |
@@ -471,7 +475,8 @@ int gfs2_lookup_master_dir(struct gfs2_sbd *sdp) | |||
471 | 475 | ||
472 | int gfs2_make_fs_rw(struct gfs2_sbd *sdp) | 476 | int gfs2_make_fs_rw(struct gfs2_sbd *sdp) |
473 | { | 477 | { |
474 | struct gfs2_glock *j_gl = get_v2ip(sdp->sd_jdesc->jd_inode)->i_gl; | 478 | struct gfs2_inode *ip = sdp->sd_jdesc->jd_inode->u.generic_ip; |
479 | struct gfs2_glock *j_gl = ip->i_gl; | ||
475 | struct gfs2_holder t_gh; | 480 | struct gfs2_holder t_gh; |
476 | struct gfs2_log_header head; | 481 | struct gfs2_log_header head; |
477 | int error; | 482 | int error; |
@@ -481,7 +486,7 @@ int gfs2_make_fs_rw(struct gfs2_sbd *sdp) | |||
481 | if (error) | 486 | if (error) |
482 | return error; | 487 | return error; |
483 | 488 | ||
484 | gfs2_meta_cache_flush(get_v2ip(sdp->sd_jdesc->jd_inode)); | 489 | gfs2_meta_cache_flush(ip); |
485 | j_gl->gl_ops->go_inval(j_gl, DIO_METADATA | DIO_DATA); | 490 | j_gl->gl_ops->go_inval(j_gl, DIO_METADATA | DIO_DATA); |
486 | 491 | ||
487 | error = gfs2_find_jhead(sdp->sd_jdesc, &head); | 492 | error = gfs2_find_jhead(sdp->sd_jdesc, &head); |
@@ -559,9 +564,9 @@ int gfs2_make_fs_ro(struct gfs2_sbd *sdp) | |||
559 | 564 | ||
560 | int gfs2_statfs_init(struct gfs2_sbd *sdp) | 565 | int gfs2_statfs_init(struct gfs2_sbd *sdp) |
561 | { | 566 | { |
562 | struct gfs2_inode *m_ip = get_v2ip(sdp->sd_statfs_inode); | 567 | struct gfs2_inode *m_ip = sdp->sd_statfs_inode->u.generic_ip; |
563 | struct gfs2_statfs_change *m_sc = &sdp->sd_statfs_master; | 568 | struct gfs2_statfs_change *m_sc = &sdp->sd_statfs_master; |
564 | struct gfs2_inode *l_ip = get_v2ip(sdp->sd_sc_inode); | 569 | struct gfs2_inode *l_ip = sdp->sd_sc_inode->u.generic_ip; |
565 | struct gfs2_statfs_change *l_sc = &sdp->sd_statfs_local; | 570 | struct gfs2_statfs_change *l_sc = &sdp->sd_statfs_local; |
566 | struct buffer_head *m_bh, *l_bh; | 571 | struct buffer_head *m_bh, *l_bh; |
567 | struct gfs2_holder gh; | 572 | struct gfs2_holder gh; |
@@ -608,7 +613,7 @@ int gfs2_statfs_init(struct gfs2_sbd *sdp) | |||
608 | void gfs2_statfs_change(struct gfs2_sbd *sdp, int64_t total, int64_t free, | 613 | void gfs2_statfs_change(struct gfs2_sbd *sdp, int64_t total, int64_t free, |
609 | int64_t dinodes) | 614 | int64_t dinodes) |
610 | { | 615 | { |
611 | struct gfs2_inode *l_ip = get_v2ip(sdp->sd_sc_inode); | 616 | struct gfs2_inode *l_ip = sdp->sd_sc_inode->u.generic_ip; |
612 | struct gfs2_statfs_change *l_sc = &sdp->sd_statfs_local; | 617 | struct gfs2_statfs_change *l_sc = &sdp->sd_statfs_local; |
613 | struct buffer_head *l_bh; | 618 | struct buffer_head *l_bh; |
614 | int error; | 619 | int error; |
@@ -634,8 +639,8 @@ void gfs2_statfs_change(struct gfs2_sbd *sdp, int64_t total, int64_t free, | |||
634 | 639 | ||
635 | int gfs2_statfs_sync(struct gfs2_sbd *sdp) | 640 | int gfs2_statfs_sync(struct gfs2_sbd *sdp) |
636 | { | 641 | { |
637 | struct gfs2_inode *m_ip = get_v2ip(sdp->sd_statfs_inode); | 642 | struct gfs2_inode *m_ip = sdp->sd_statfs_inode->u.generic_ip; |
638 | struct gfs2_inode *l_ip = get_v2ip(sdp->sd_sc_inode); | 643 | struct gfs2_inode *l_ip = sdp->sd_sc_inode->u.generic_ip; |
639 | struct gfs2_statfs_change *m_sc = &sdp->sd_statfs_master; | 644 | struct gfs2_statfs_change *m_sc = &sdp->sd_statfs_master; |
640 | struct gfs2_statfs_change *l_sc = &sdp->sd_statfs_local; | 645 | struct gfs2_statfs_change *l_sc = &sdp->sd_statfs_local; |
641 | struct gfs2_holder gh; | 646 | struct gfs2_holder gh; |
@@ -795,7 +800,8 @@ int gfs2_statfs_slow(struct gfs2_sbd *sdp, struct gfs2_statfs_change *sc) | |||
795 | error = err; | 800 | error = err; |
796 | } else { | 801 | } else { |
797 | if (!error) | 802 | if (!error) |
798 | error = statfs_slow_fill(get_gl2rgd(gh->gh_gl), sc); | 803 | error = statfs_slow_fill( |
804 | gh->gh_gl->gl_object, sc); | ||
799 | gfs2_glock_dq_uninit(gh); | 805 | gfs2_glock_dq_uninit(gh); |
800 | } | 806 | } |
801 | } | 807 | } |
@@ -846,6 +852,7 @@ struct lfcc { | |||
846 | 852 | ||
847 | int gfs2_lock_fs_check_clean(struct gfs2_sbd *sdp, struct gfs2_holder *t_gh) | 853 | int gfs2_lock_fs_check_clean(struct gfs2_sbd *sdp, struct gfs2_holder *t_gh) |
848 | { | 854 | { |
855 | struct gfs2_inode *ip; | ||
849 | struct gfs2_holder ji_gh; | 856 | struct gfs2_holder ji_gh; |
850 | struct gfs2_jdesc *jd; | 857 | struct gfs2_jdesc *jd; |
851 | struct lfcc *lfcc; | 858 | struct lfcc *lfcc; |
@@ -863,7 +870,8 @@ int gfs2_lock_fs_check_clean(struct gfs2_sbd *sdp, struct gfs2_holder *t_gh) | |||
863 | error = -ENOMEM; | 870 | error = -ENOMEM; |
864 | goto out; | 871 | goto out; |
865 | } | 872 | } |
866 | error = gfs2_glock_nq_init(get_v2ip(jd->jd_inode)->i_gl, | 873 | ip = jd->jd_inode->u.generic_ip; |
874 | error = gfs2_glock_nq_init(ip->i_gl, | ||
867 | LM_ST_SHARED, 0, | 875 | LM_ST_SHARED, 0, |
868 | &lfcc->gh); | 876 | &lfcc->gh); |
869 | if (error) { | 877 | if (error) { |