aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2
diff options
context:
space:
mode:
Diffstat (limited to 'fs/gfs2')
-rw-r--r--fs/gfs2/dir.c9
-rw-r--r--fs/gfs2/dir.h1
-rw-r--r--fs/gfs2/file.c22
-rw-r--r--fs/gfs2/glock.c4
-rw-r--r--fs/gfs2/glops.c2
-rw-r--r--fs/gfs2/inode.c7
-rw-r--r--fs/gfs2/rgrp.c30
-rw-r--r--fs/gfs2/rgrp.h1
-rw-r--r--fs/gfs2/trans.c2
9 files changed, 39 insertions, 39 deletions
diff --git a/fs/gfs2/dir.c b/fs/gfs2/dir.c
index 1a349f9a9685..5d4261ff5d23 100644
--- a/fs/gfs2/dir.c
+++ b/fs/gfs2/dir.c
@@ -2100,8 +2100,13 @@ int gfs2_diradd_alloc_required(struct inode *inode, const struct qstr *name,
2100 } 2100 }
2101 if (IS_ERR(dent)) 2101 if (IS_ERR(dent))
2102 return PTR_ERR(dent); 2102 return PTR_ERR(dent);
2103 da->bh = bh; 2103
2104 da->dent = dent; 2104 if (da->save_loc) {
2105 da->bh = bh;
2106 da->dent = dent;
2107 } else {
2108 brelse(bh);
2109 }
2105 return 0; 2110 return 0;
2106} 2111}
2107 2112
diff --git a/fs/gfs2/dir.h b/fs/gfs2/dir.h
index 126c65dda028..e1b309c24dab 100644
--- a/fs/gfs2/dir.h
+++ b/fs/gfs2/dir.h
@@ -23,6 +23,7 @@ struct gfs2_diradd {
23 unsigned nr_blocks; 23 unsigned nr_blocks;
24 struct gfs2_dirent *dent; 24 struct gfs2_dirent *dent;
25 struct buffer_head *bh; 25 struct buffer_head *bh;
26 int save_loc;
26}; 27};
27 28
28extern struct inode *gfs2_dir_search(struct inode *dir, 29extern struct inode *gfs2_dir_search(struct inode *dir,
diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c
index 7f4ed3daa38c..80dd44dca028 100644
--- a/fs/gfs2/file.c
+++ b/fs/gfs2/file.c
@@ -914,26 +914,6 @@ out_uninit:
914#ifdef CONFIG_GFS2_FS_LOCKING_DLM 914#ifdef CONFIG_GFS2_FS_LOCKING_DLM
915 915
916/** 916/**
917 * gfs2_setlease - acquire/release a file lease
918 * @file: the file pointer
919 * @arg: lease type
920 * @fl: file lock
921 *
922 * We don't currently have a way to enforce a lease across the whole
923 * cluster; until we do, disable leases (by just returning -EINVAL),
924 * unless the administrator has requested purely local locking.
925 *
926 * Locking: called under i_lock
927 *
928 * Returns: errno
929 */
930
931static int gfs2_setlease(struct file *file, long arg, struct file_lock **fl)
932{
933 return -EINVAL;
934}
935
936/**
937 * gfs2_lock - acquire/release a posix lock on a file 917 * gfs2_lock - acquire/release a posix lock on a file
938 * @file: the file pointer 918 * @file: the file pointer
939 * @cmd: either modify or retrieve lock state, possibly wait 919 * @cmd: either modify or retrieve lock state, possibly wait
@@ -1078,7 +1058,7 @@ const struct file_operations gfs2_file_fops = {
1078 .flock = gfs2_flock, 1058 .flock = gfs2_flock,
1079 .splice_read = generic_file_splice_read, 1059 .splice_read = generic_file_splice_read,
1080 .splice_write = iter_file_splice_write, 1060 .splice_write = iter_file_splice_write,
1081 .setlease = gfs2_setlease, 1061 .setlease = simple_nosetlease,
1082 .fallocate = gfs2_fallocate, 1062 .fallocate = gfs2_fallocate,
1083}; 1063};
1084 1064
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
index 7f513b1ceb2c..8f0c19d1d943 100644
--- a/fs/gfs2/glock.c
+++ b/fs/gfs2/glock.c
@@ -811,7 +811,7 @@ void gfs2_holder_init(struct gfs2_glock *gl, unsigned int state, unsigned flags,
811{ 811{
812 INIT_LIST_HEAD(&gh->gh_list); 812 INIT_LIST_HEAD(&gh->gh_list);
813 gh->gh_gl = gl; 813 gh->gh_gl = gl;
814 gh->gh_ip = (unsigned long)__builtin_return_address(0); 814 gh->gh_ip = _RET_IP_;
815 gh->gh_owner_pid = get_pid(task_pid(current)); 815 gh->gh_owner_pid = get_pid(task_pid(current));
816 gh->gh_state = state; 816 gh->gh_state = state;
817 gh->gh_flags = flags; 817 gh->gh_flags = flags;
@@ -835,7 +835,7 @@ void gfs2_holder_reinit(unsigned int state, unsigned flags, struct gfs2_holder *
835 gh->gh_state = state; 835 gh->gh_state = state;
836 gh->gh_flags = flags; 836 gh->gh_flags = flags;
837 gh->gh_iflags = 0; 837 gh->gh_iflags = 0;
838 gh->gh_ip = (unsigned long)__builtin_return_address(0); 838 gh->gh_ip = _RET_IP_;
839 if (gh->gh_owner_pid) 839 if (gh->gh_owner_pid)
840 put_pid(gh->gh_owner_pid); 840 put_pid(gh->gh_owner_pid);
841 gh->gh_owner_pid = get_pid(task_pid(current)); 841 gh->gh_owner_pid = get_pid(task_pid(current));
diff --git a/fs/gfs2/glops.c b/fs/gfs2/glops.c
index 2ffc67dce87f..1cc0bba6313f 100644
--- a/fs/gfs2/glops.c
+++ b/fs/gfs2/glops.c
@@ -93,7 +93,7 @@ static void gfs2_ail_empty_gl(struct gfs2_glock *gl)
93 * tr->alloced is not set since the transaction structure is 93 * tr->alloced is not set since the transaction structure is
94 * on the stack */ 94 * on the stack */
95 tr.tr_reserved = 1 + gfs2_struct2blk(sdp, tr.tr_revokes, sizeof(u64)); 95 tr.tr_reserved = 1 + gfs2_struct2blk(sdp, tr.tr_revokes, sizeof(u64));
96 tr.tr_ip = (unsigned long)__builtin_return_address(0); 96 tr.tr_ip = _RET_IP_;
97 sb_start_intwrite(sdp->sd_vfs); 97 sb_start_intwrite(sdp->sd_vfs);
98 if (gfs2_log_reserve(sdp, tr.tr_reserved) < 0) { 98 if (gfs2_log_reserve(sdp, tr.tr_reserved) < 0) {
99 sb_end_intwrite(sdp->sd_vfs); 99 sb_end_intwrite(sdp->sd_vfs);
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c
index 8108b4f0354c..c4ed823d150e 100644
--- a/fs/gfs2/inode.c
+++ b/fs/gfs2/inode.c
@@ -600,7 +600,7 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry,
600 int error, free_vfs_inode = 0; 600 int error, free_vfs_inode = 0;
601 u32 aflags = 0; 601 u32 aflags = 0;
602 unsigned blocks = 1; 602 unsigned blocks = 1;
603 struct gfs2_diradd da = { .bh = NULL, }; 603 struct gfs2_diradd da = { .bh = NULL, .save_loc = 1, };
604 604
605 if (!name->len || name->len > GFS2_FNAMESIZE) 605 if (!name->len || name->len > GFS2_FNAMESIZE)
606 return -ENAMETOOLONG; 606 return -ENAMETOOLONG;
@@ -672,6 +672,7 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry,
672 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; 672 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
673 gfs2_set_inode_blocks(inode, 1); 673 gfs2_set_inode_blocks(inode, 1);
674 munge_mode_uid_gid(dip, inode); 674 munge_mode_uid_gid(dip, inode);
675 check_and_update_goal(dip);
675 ip->i_goal = dip->i_goal; 676 ip->i_goal = dip->i_goal;
676 ip->i_diskflags = 0; 677 ip->i_diskflags = 0;
677 ip->i_eattr = 0; 678 ip->i_eattr = 0;
@@ -899,7 +900,7 @@ static int gfs2_link(struct dentry *old_dentry, struct inode *dir,
899 struct gfs2_inode *ip = GFS2_I(inode); 900 struct gfs2_inode *ip = GFS2_I(inode);
900 struct gfs2_holder ghs[2]; 901 struct gfs2_holder ghs[2];
901 struct buffer_head *dibh; 902 struct buffer_head *dibh;
902 struct gfs2_diradd da = { .bh = NULL, }; 903 struct gfs2_diradd da = { .bh = NULL, .save_loc = 1, };
903 int error; 904 int error;
904 905
905 if (S_ISDIR(inode->i_mode)) 906 if (S_ISDIR(inode->i_mode))
@@ -1342,7 +1343,7 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry,
1342 struct gfs2_rgrpd *nrgd; 1343 struct gfs2_rgrpd *nrgd;
1343 unsigned int num_gh; 1344 unsigned int num_gh;
1344 int dir_rename = 0; 1345 int dir_rename = 0;
1345 struct gfs2_diradd da = { .nr_blocks = 0, }; 1346 struct gfs2_diradd da = { .nr_blocks = 0, .save_loc = 0, };
1346 unsigned int x; 1347 unsigned int x;
1347 int error; 1348 int error;
1348 1349
diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c
index f4cb9c0d6bbd..7474c413ffd1 100644
--- a/fs/gfs2/rgrp.c
+++ b/fs/gfs2/rgrp.c
@@ -577,6 +577,13 @@ struct gfs2_rgrpd *gfs2_rgrpd_get_next(struct gfs2_rgrpd *rgd)
577 return rgd; 577 return rgd;
578} 578}
579 579
580void check_and_update_goal(struct gfs2_inode *ip)
581{
582 struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
583 if (!ip->i_goal || gfs2_blk2rgrpd(sdp, ip->i_goal, 1) == NULL)
584 ip->i_goal = ip->i_no_addr;
585}
586
580void gfs2_free_clones(struct gfs2_rgrpd *rgd) 587void gfs2_free_clones(struct gfs2_rgrpd *rgd)
581{ 588{
582 int x; 589 int x;
@@ -1910,6 +1917,7 @@ int gfs2_inplace_reserve(struct gfs2_inode *ip, const struct gfs2_alloc_parms *a
1910 } else if (ip->i_rgd && rgrp_contains_block(ip->i_rgd, ip->i_goal)) { 1917 } else if (ip->i_rgd && rgrp_contains_block(ip->i_rgd, ip->i_goal)) {
1911 rs->rs_rbm.rgd = begin = ip->i_rgd; 1918 rs->rs_rbm.rgd = begin = ip->i_rgd;
1912 } else { 1919 } else {
1920 check_and_update_goal(ip);
1913 rs->rs_rbm.rgd = begin = gfs2_blk2rgrpd(sdp, ip->i_goal, 1); 1921 rs->rs_rbm.rgd = begin = gfs2_blk2rgrpd(sdp, ip->i_goal, 1);
1914 } 1922 }
1915 if (S_ISDIR(ip->i_inode.i_mode) && (ap->aflags & GFS2_AF_ORLOV)) 1923 if (S_ISDIR(ip->i_inode.i_mode) && (ap->aflags & GFS2_AF_ORLOV))
@@ -2089,7 +2097,7 @@ static struct gfs2_rgrpd *rgblk_free(struct gfs2_sbd *sdp, u64 bstart,
2089 u32 blen, unsigned char new_state) 2097 u32 blen, unsigned char new_state)
2090{ 2098{
2091 struct gfs2_rbm rbm; 2099 struct gfs2_rbm rbm;
2092 struct gfs2_bitmap *bi; 2100 struct gfs2_bitmap *bi, *bi_prev = NULL;
2093 2101
2094 rbm.rgd = gfs2_blk2rgrpd(sdp, bstart, 1); 2102 rbm.rgd = gfs2_blk2rgrpd(sdp, bstart, 1);
2095 if (!rbm.rgd) { 2103 if (!rbm.rgd) {
@@ -2098,18 +2106,22 @@ static struct gfs2_rgrpd *rgblk_free(struct gfs2_sbd *sdp, u64 bstart,
2098 return NULL; 2106 return NULL;
2099 } 2107 }
2100 2108
2109 gfs2_rbm_from_block(&rbm, bstart);
2101 while (blen--) { 2110 while (blen--) {
2102 gfs2_rbm_from_block(&rbm, bstart);
2103 bi = rbm_bi(&rbm); 2111 bi = rbm_bi(&rbm);
2104 bstart++; 2112 if (bi != bi_prev) {
2105 if (!bi->bi_clone) { 2113 if (!bi->bi_clone) {
2106 bi->bi_clone = kmalloc(bi->bi_bh->b_size, 2114 bi->bi_clone = kmalloc(bi->bi_bh->b_size,
2107 GFP_NOFS | __GFP_NOFAIL); 2115 GFP_NOFS | __GFP_NOFAIL);
2108 memcpy(bi->bi_clone + bi->bi_offset, 2116 memcpy(bi->bi_clone + bi->bi_offset,
2109 bi->bi_bh->b_data + bi->bi_offset, bi->bi_len); 2117 bi->bi_bh->b_data + bi->bi_offset,
2118 bi->bi_len);
2119 }
2120 gfs2_trans_add_meta(rbm.rgd->rd_gl, bi->bi_bh);
2121 bi_prev = bi;
2110 } 2122 }
2111 gfs2_trans_add_meta(rbm.rgd->rd_gl, bi->bi_bh);
2112 gfs2_setbit(&rbm, false, new_state); 2123 gfs2_setbit(&rbm, false, new_state);
2124 gfs2_rbm_incr(&rbm);
2113 } 2125 }
2114 2126
2115 return rbm.rgd; 2127 return rbm.rgd;
diff --git a/fs/gfs2/rgrp.h b/fs/gfs2/rgrp.h
index 463ab2e95d1c..5d8f085f7ade 100644
--- a/fs/gfs2/rgrp.h
+++ b/fs/gfs2/rgrp.h
@@ -80,4 +80,5 @@ static inline bool gfs2_rs_active(struct gfs2_blkreserv *rs)
80 return rs && !RB_EMPTY_NODE(&rs->rs_node); 80 return rs && !RB_EMPTY_NODE(&rs->rs_node);
81} 81}
82 82
83extern void check_and_update_goal(struct gfs2_inode *ip);
83#endif /* __RGRP_DOT_H__ */ 84#endif /* __RGRP_DOT_H__ */
diff --git a/fs/gfs2/trans.c b/fs/gfs2/trans.c
index 0546ab4e28e8..42bfd3361979 100644
--- a/fs/gfs2/trans.c
+++ b/fs/gfs2/trans.c
@@ -44,7 +44,7 @@ int gfs2_trans_begin(struct gfs2_sbd *sdp, unsigned int blocks,
44 if (!tr) 44 if (!tr)
45 return -ENOMEM; 45 return -ENOMEM;
46 46
47 tr->tr_ip = (unsigned long)__builtin_return_address(0); 47 tr->tr_ip = _RET_IP_;
48 tr->tr_blocks = blocks; 48 tr->tr_blocks = blocks;
49 tr->tr_revokes = revokes; 49 tr->tr_revokes = revokes;
50 tr->tr_reserved = 1; 50 tr->tr_reserved = 1;