Skip to content

Commit 4c7b3f7

Browse files
author
Andreas Gruenbacher
committed
gfs2: Get rid of gfs2_alloc_blocks generation parameter
Get rid of the generation parameter of gfs2_alloc_blocks(): we only ever set the generation of the current inode while creating it, so do so directly. Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
1 parent 92099f0 commit 4c7b3f7

6 files changed

Lines changed: 15 additions & 13 deletions

File tree

fs/gfs2/bmap.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ static int __gfs2_unstuff_inode(struct gfs2_inode *ip, struct page *page)
106106
and write it out to disk */
107107

108108
unsigned int n = 1;
109-
error = gfs2_alloc_blocks(ip, &block, &n, 0, NULL);
109+
error = gfs2_alloc_blocks(ip, &block, &n, 0);
110110
if (error)
111111
goto out_brelse;
112112
if (isdir) {
@@ -707,7 +707,7 @@ static int __gfs2_iomap_alloc(struct inode *inode, struct iomap *iomap,
707707
i = mp->mp_aheight;
708708
do {
709709
n = blks - alloced;
710-
ret = gfs2_alloc_blocks(ip, &bn, &n, 0, NULL);
710+
ret = gfs2_alloc_blocks(ip, &bn, &n, 0);
711711
if (ret)
712712
goto out;
713713
alloced += n;

fs/gfs2/dir.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -868,7 +868,7 @@ static struct gfs2_leaf *new_leaf(struct inode *inode, struct buffer_head **pbh,
868868
struct gfs2_dirent *dent;
869869
struct timespec64 tv = current_time(inode);
870870

871-
error = gfs2_alloc_blocks(ip, &bn, &n, 0, NULL);
871+
error = gfs2_alloc_blocks(ip, &bn, &n, 0);
872872
if (error)
873873
return NULL;
874874
bh = gfs2_meta_new(ip->i_gl, bn);

fs/gfs2/inode.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ static int alloc_dinode(struct gfs2_inode *ip, u32 flags, unsigned *dblocks)
417417
if (error)
418418
goto out_ipreserv;
419419

420-
error = gfs2_alloc_blocks(ip, &ip->i_no_addr, dblocks, 1, &ip->i_generation);
420+
error = gfs2_alloc_blocks(ip, &ip->i_no_addr, dblocks, 1);
421421
if (error)
422422
goto out_trans_end;
423423

fs/gfs2/rgrp.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2411,13 +2411,12 @@ static void gfs2_set_alloc_start(struct gfs2_rbm *rbm,
24112411
* @bn: Used to return the starting block number
24122412
* @nblocks: requested number of blocks/extent length (value/result)
24132413
* @dinode: 1 if we're allocating a dinode block, else 0
2414-
* @generation: the generation number of the inode
24152414
*
24162415
* Returns: 0 or error
24172416
*/
24182417

24192418
int gfs2_alloc_blocks(struct gfs2_inode *ip, u64 *bn, unsigned int *nblocks,
2420-
bool dinode, u64 *generation)
2419+
bool dinode)
24212420
{
24222421
struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
24232422
struct buffer_head *dibh;
@@ -2477,10 +2476,13 @@ int gfs2_alloc_blocks(struct gfs2_inode *ip, u64 *bn, unsigned int *nblocks,
24772476
rbm.rgd->rd_free -= *nblocks;
24782477
spin_unlock(&rbm.rgd->rd_rsspin);
24792478
if (dinode) {
2479+
u64 generation;
2480+
24802481
rbm.rgd->rd_dinodes++;
2481-
*generation = rbm.rgd->rd_igeneration++;
2482-
if (*generation == 0)
2483-
*generation = rbm.rgd->rd_igeneration++;
2482+
generation = rbm.rgd->rd_igeneration++;
2483+
if (generation == 0)
2484+
generation = rbm.rgd->rd_igeneration++;
2485+
ip->i_generation = generation;
24842486
}
24852487

24862488
gfs2_trans_add_meta(rbm.rgd->rd_gl, rbm.rgd->rd_bits[0].bi_bh);

fs/gfs2/rgrp.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ extern int gfs2_inplace_reserve(struct gfs2_inode *ip,
4242
extern void gfs2_inplace_release(struct gfs2_inode *ip);
4343

4444
extern int gfs2_alloc_blocks(struct gfs2_inode *ip, u64 *bn, unsigned int *n,
45-
bool dinode, u64 *generation);
45+
bool dinode);
4646

4747
extern void gfs2_rs_deltree(struct gfs2_blkreserv *rs);
4848
extern void gfs2_rs_delete(struct gfs2_inode *ip);

fs/gfs2/xattr.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,7 @@ static int ea_alloc_blk(struct gfs2_inode *ip, struct buffer_head **bhp)
639639
u64 block;
640640
int error;
641641

642-
error = gfs2_alloc_blocks(ip, &block, &n, 0, NULL);
642+
error = gfs2_alloc_blocks(ip, &block, &n, 0);
643643
if (error)
644644
return error;
645645
gfs2_trans_remove_revoke(sdp, block, 1);
@@ -701,7 +701,7 @@ static int ea_write(struct gfs2_inode *ip, struct gfs2_ea_header *ea,
701701
int mh_size = sizeof(struct gfs2_meta_header);
702702
unsigned int n = 1;
703703

704-
error = gfs2_alloc_blocks(ip, &block, &n, 0, NULL);
704+
error = gfs2_alloc_blocks(ip, &block, &n, 0);
705705
if (error)
706706
return error;
707707
gfs2_trans_remove_revoke(sdp, block, 1);
@@ -1002,7 +1002,7 @@ static int ea_set_block(struct gfs2_inode *ip, struct gfs2_ea_request *er,
10021002
} else {
10031003
u64 blk;
10041004
unsigned int n = 1;
1005-
error = gfs2_alloc_blocks(ip, &blk, &n, 0, NULL);
1005+
error = gfs2_alloc_blocks(ip, &blk, &n, 0);
10061006
if (error)
10071007
return error;
10081008
gfs2_trans_remove_revoke(sdp, blk, 1);

0 commit comments

Comments
 (0)