Skip to content

Commit

Permalink
gfs2: Get rid of unnecessary variable in gfs2_alloc_blocks
Browse files Browse the repository at this point in the history
Variable ndata is only used inside "if (!dinode)", so it can be replaced
entirely with *nblocks.

Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
  • Loading branch information
Andreas Gruenbacher committed Jan 18, 2021
1 parent c65b76b commit 3ed08be
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions fs/gfs2/rgrp.c
Original file line number Diff line number Diff line change
Expand Up @@ -2386,7 +2386,6 @@ int gfs2_alloc_blocks(struct gfs2_inode *ip, u64 *bn, unsigned int *nblocks,
struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
struct buffer_head *dibh;
struct gfs2_rbm rbm = { .rgd = ip->i_res.rs_rgd, };
unsigned int ndata;
u64 block; /* block, within the file system scope */
int error;

Expand All @@ -2412,12 +2411,8 @@ int gfs2_alloc_blocks(struct gfs2_inode *ip, u64 *bn, unsigned int *nblocks,
rbm.rgd->rd_last_alloc = block - rbm.rgd->rd_data0;
if (gfs2_rs_active(&ip->i_res))
gfs2_adjust_reservation(ip, &rbm, *nblocks);
ndata = *nblocks;
if (dinode)
ndata--;

if (!dinode) {
ip->i_goal = block + ndata - 1;
ip->i_goal = block + *nblocks - 1;
error = gfs2_meta_inode_buffer(ip, &dibh);
if (error == 0) {
struct gfs2_dinode *di =
Expand Down

0 comments on commit 3ed08be

Please sign in to comment.