diff options
Diffstat (limited to 'fs/gfs2/inode.c')
-rw-r--r-- | fs/gfs2/inode.c | 46 |
1 files changed, 20 insertions, 26 deletions
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c index f4c48395208a..22ca3b5ddaea 100644 --- a/fs/gfs2/inode.c +++ b/fs/gfs2/inode.c | |||
@@ -38,15 +38,17 @@ | |||
38 | #include "util.h" | 38 | #include "util.h" |
39 | 39 | ||
40 | /** | 40 | /** |
41 | * inode_attr_in - Copy attributes from the dinode into the VFS inode | 41 | * gfs2_inode_attr_in - Copy attributes from the dinode into the VFS inode |
42 | * @ip: The GFS2 inode (with embedded disk inode data) | 42 | * @ip: The GFS2 inode (with embedded disk inode data) |
43 | * @inode: The Linux VFS inode | 43 | * @inode: The Linux VFS inode |
44 | * | 44 | * |
45 | */ | 45 | */ |
46 | 46 | ||
47 | static void inode_attr_in(struct gfs2_inode *ip, struct inode *inode) | 47 | void gfs2_inode_attr_in(struct gfs2_inode *ip) |
48 | { | 48 | { |
49 | inode->i_ino = ip->i_num.no_formal_ino; | 49 | struct inode *inode = &ip->i_inode; |
50 | |||
51 | inode->i_ino = ip->i_num.no_addr; | ||
50 | 52 | ||
51 | switch (ip->i_di.di_mode & S_IFMT) { | 53 | switch (ip->i_di.di_mode & S_IFMT) { |
52 | case S_IFBLK: | 54 | case S_IFBLK: |
@@ -85,18 +87,6 @@ static void inode_attr_in(struct gfs2_inode *ip, struct inode *inode) | |||
85 | } | 87 | } |
86 | 88 | ||
87 | /** | 89 | /** |
88 | * gfs2_inode_attr_in - Copy attributes from the dinode into the VFS inode | ||
89 | * @ip: The GFS2 inode (with embedded disk inode data) | ||
90 | * | ||
91 | */ | ||
92 | |||
93 | void gfs2_inode_attr_in(struct gfs2_inode *ip) | ||
94 | { | ||
95 | struct inode *inode = &ip->i_inode; | ||
96 | inode_attr_in(ip, inode); | ||
97 | } | ||
98 | |||
99 | /** | ||
100 | * gfs2_inode_attr_out - Copy attributes from VFS inode into the dinode | 90 | * gfs2_inode_attr_out - Copy attributes from VFS inode into the dinode |
101 | * @ip: The GFS2 inode | 91 | * @ip: The GFS2 inode |
102 | * | 92 | * |
@@ -621,7 +611,8 @@ static void munge_mode_uid_gid(struct gfs2_inode *dip, unsigned int *mode, | |||
621 | *gid = current->fsgid; | 611 | *gid = current->fsgid; |
622 | } | 612 | } |
623 | 613 | ||
624 | static int alloc_dinode(struct gfs2_inode *dip, struct gfs2_inum *inum) | 614 | static int alloc_dinode(struct gfs2_inode *dip, struct gfs2_inum *inum, |
615 | u64 *generation) | ||
625 | { | 616 | { |
626 | struct gfs2_sbd *sdp = GFS2_SB(&dip->i_inode); | 617 | struct gfs2_sbd *sdp = GFS2_SB(&dip->i_inode); |
627 | int error; | 618 | int error; |
@@ -637,14 +628,14 @@ static int alloc_dinode(struct gfs2_inode *dip, struct gfs2_inum *inum) | |||
637 | if (error) | 628 | if (error) |
638 | goto out_ipreserv; | 629 | goto out_ipreserv; |
639 | 630 | ||
640 | inum->no_addr = gfs2_alloc_di(dip); | 631 | inum->no_addr = gfs2_alloc_di(dip, generation); |
641 | 632 | ||
642 | gfs2_trans_end(sdp); | 633 | gfs2_trans_end(sdp); |
643 | 634 | ||
644 | out_ipreserv: | 635 | out_ipreserv: |
645 | gfs2_inplace_release(dip); | 636 | gfs2_inplace_release(dip); |
646 | 637 | ||
647 | out: | 638 | out: |
648 | gfs2_alloc_put(dip); | 639 | gfs2_alloc_put(dip); |
649 | 640 | ||
650 | return error; | 641 | return error; |
@@ -662,8 +653,9 @@ static int alloc_dinode(struct gfs2_inode *dip, struct gfs2_inum *inum) | |||
662 | */ | 653 | */ |
663 | 654 | ||
664 | static void init_dinode(struct gfs2_inode *dip, struct gfs2_glock *gl, | 655 | static void init_dinode(struct gfs2_inode *dip, struct gfs2_glock *gl, |
665 | struct gfs2_inum *inum, unsigned int mode, | 656 | const struct gfs2_inum *inum, unsigned int mode, |
666 | unsigned int uid, unsigned int gid) | 657 | unsigned int uid, unsigned int gid, |
658 | const u64 *generation) | ||
667 | { | 659 | { |
668 | struct gfs2_sbd *sdp = GFS2_SB(&dip->i_inode); | 660 | struct gfs2_sbd *sdp = GFS2_SB(&dip->i_inode); |
669 | struct gfs2_dinode *di; | 661 | struct gfs2_dinode *di; |
@@ -686,7 +678,7 @@ static void init_dinode(struct gfs2_inode *dip, struct gfs2_glock *gl, | |||
686 | di->di_atime = di->di_mtime = di->di_ctime = cpu_to_be64(get_seconds()); | 678 | di->di_atime = di->di_mtime = di->di_ctime = cpu_to_be64(get_seconds()); |
687 | di->di_major = di->di_minor = cpu_to_be32(0); | 679 | di->di_major = di->di_minor = cpu_to_be32(0); |
688 | di->di_goal_meta = di->di_goal_data = cpu_to_be64(inum->no_addr); | 680 | di->di_goal_meta = di->di_goal_data = cpu_to_be64(inum->no_addr); |
689 | di->__pad[0] = di->__pad[1] = 0; | 681 | di->di_generation = cpu_to_be64(*generation); |
690 | di->di_flags = cpu_to_be32(0); | 682 | di->di_flags = cpu_to_be32(0); |
691 | 683 | ||
692 | if (S_ISREG(mode)) { | 684 | if (S_ISREG(mode)) { |
@@ -717,7 +709,8 @@ static void init_dinode(struct gfs2_inode *dip, struct gfs2_glock *gl, | |||
717 | } | 709 | } |
718 | 710 | ||
719 | static int make_dinode(struct gfs2_inode *dip, struct gfs2_glock *gl, | 711 | static int make_dinode(struct gfs2_inode *dip, struct gfs2_glock *gl, |
720 | unsigned int mode, struct gfs2_inum *inum) | 712 | unsigned int mode, const struct gfs2_inum *inum, |
713 | const u64 *generation) | ||
721 | { | 714 | { |
722 | struct gfs2_sbd *sdp = GFS2_SB(&dip->i_inode); | 715 | struct gfs2_sbd *sdp = GFS2_SB(&dip->i_inode); |
723 | unsigned int uid, gid; | 716 | unsigned int uid, gid; |
@@ -738,7 +731,7 @@ static int make_dinode(struct gfs2_inode *dip, struct gfs2_glock *gl, | |||
738 | if (error) | 731 | if (error) |
739 | goto out_quota; | 732 | goto out_quota; |
740 | 733 | ||
741 | init_dinode(dip, gl, inum, mode, uid, gid); | 734 | init_dinode(dip, gl, inum, mode, uid, gid, generation); |
742 | gfs2_quota_change(dip, +1, uid, gid); | 735 | gfs2_quota_change(dip, +1, uid, gid); |
743 | gfs2_trans_end(sdp); | 736 | gfs2_trans_end(sdp); |
744 | 737 | ||
@@ -844,6 +837,7 @@ struct inode *gfs2_createi(struct gfs2_holder *ghs, const struct qstr *name, | |||
844 | struct gfs2_sbd *sdp = GFS2_SB(&dip->i_inode); | 837 | struct gfs2_sbd *sdp = GFS2_SB(&dip->i_inode); |
845 | struct gfs2_inum inum; | 838 | struct gfs2_inum inum; |
846 | int error; | 839 | int error; |
840 | u64 generation; | ||
847 | 841 | ||
848 | if (!name->len || name->len > GFS2_FNAMESIZE) | 842 | if (!name->len || name->len > GFS2_FNAMESIZE) |
849 | return ERR_PTR(-ENAMETOOLONG); | 843 | return ERR_PTR(-ENAMETOOLONG); |
@@ -861,7 +855,7 @@ struct inode *gfs2_createi(struct gfs2_holder *ghs, const struct qstr *name, | |||
861 | if (error) | 855 | if (error) |
862 | goto fail_gunlock; | 856 | goto fail_gunlock; |
863 | 857 | ||
864 | error = alloc_dinode(dip, &inum); | 858 | error = alloc_dinode(dip, &inum, &generation); |
865 | if (error) | 859 | if (error) |
866 | goto fail_gunlock; | 860 | goto fail_gunlock; |
867 | 861 | ||
@@ -893,7 +887,7 @@ struct inode *gfs2_createi(struct gfs2_holder *ghs, const struct qstr *name, | |||
893 | goto fail_gunlock; | 887 | goto fail_gunlock; |
894 | } | 888 | } |
895 | 889 | ||
896 | error = make_dinode(dip, ghs[1].gh_gl, mode, &inum); | 890 | error = make_dinode(dip, ghs[1].gh_gl, mode, &inum, &generation); |
897 | if (error) | 891 | if (error) |
898 | goto fail_gunlock2; | 892 | goto fail_gunlock2; |
899 | 893 | ||