Skip to content

Commit

Permalink
GFS2: Move gfs2_icbit_munge into quota.c
Browse files Browse the repository at this point in the history
This function is only called twice, and both callers are
quota related, so lets move this function into quota.c and
make it static.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
  • Loading branch information
Steven Whitehouse committed Oct 2, 2013
1 parent 9e07f2c commit 26e43a1
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 22 deletions.
20 changes: 20 additions & 0 deletions fs/gfs2/quota.c
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,26 @@ static void slot_hold(struct gfs2_quota_data *qd)
spin_unlock(&qd_lru_lock);
}

static void gfs2_icbit_munge(struct gfs2_sbd *sdp, unsigned char **bitmap,
unsigned int bit, int new_value)
{
unsigned int c, o, b = bit;
int old_value;

c = b / (8 * PAGE_SIZE);
b %= 8 * PAGE_SIZE;
o = b / 8;
b %= 8;

old_value = (bitmap[c][o] & (1 << b));
gfs2_assert_withdraw(sdp, !old_value != !new_value);

if (new_value)
bitmap[c][o] |= 1 << b;
else
bitmap[c][o] &= ~(1 << b);
}

static void slot_put(struct gfs2_quota_data *qd)
{
struct gfs2_sbd *sdp = qd->qd_gl->gl_sbd;
Expand Down
20 changes: 0 additions & 20 deletions fs/gfs2/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -268,23 +268,3 @@ int gfs2_io_error_bh_i(struct gfs2_sbd *sdp, struct buffer_head *bh,
return rv;
}

void gfs2_icbit_munge(struct gfs2_sbd *sdp, unsigned char **bitmap,
unsigned int bit, int new_value)
{
unsigned int c, o, b = bit;
int old_value;

c = b / (8 * PAGE_SIZE);
b %= 8 * PAGE_SIZE;
o = b / 8;
b %= 8;

old_value = (bitmap[c][o] & (1 << b));
gfs2_assert_withdraw(sdp, !old_value != !new_value);

if (new_value)
bitmap[c][o] |= 1 << b;
else
bitmap[c][o] &= ~(1 << b);
}

2 changes: 0 additions & 2 deletions fs/gfs2/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,6 @@ static inline unsigned int gfs2_tune_get_i(struct gfs2_tune *gt,
#define gfs2_tune_get(sdp, field) \
gfs2_tune_get_i(&(sdp)->sd_tune, &(sdp)->sd_tune.field)

void gfs2_icbit_munge(struct gfs2_sbd *sdp, unsigned char **bitmap,
unsigned int bit, int new_value);
int gfs2_lm_withdraw(struct gfs2_sbd *sdp, char *fmt, ...);

#endif /* __UTIL_DOT_H__ */
Expand Down

0 comments on commit 26e43a1

Please sign in to comment.