Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 75150
b: refs/heads/master
c: c525460
h: refs/heads/master
v: v3
  • Loading branch information
Jan Kara authored and Linus Torvalds committed Dec 23, 2007
1 parent a14956f commit 38ec28d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 22dd483721939b4ea22d5d3925e69112f63c42bc
refs/heads/master: c525460e2754dbb33abe2b37d3d941126b2ea830
23 changes: 16 additions & 7 deletions trunk/fs/dquot.c
Original file line number Diff line number Diff line change
Expand Up @@ -827,6 +827,18 @@ static inline void dquot_decr_space(struct dquot *dquot, qsize_t number)
clear_bit(DQ_BLKS_B, &dquot->dq_flags);
}

static int warning_issued(struct dquot *dquot, const int warntype)
{
int flag = (warntype == QUOTA_NL_BHARDWARN ||
warntype == QUOTA_NL_BSOFTLONGWARN) ? DQ_BLKS_B :
((warntype == QUOTA_NL_IHARDWARN ||
warntype == QUOTA_NL_ISOFTLONGWARN) ? DQ_INODES_B : 0);

if (!flag)
return 0;
return test_and_set_bit(flag, &dquot->dq_flags);
}

#ifdef CONFIG_PRINT_QUOTA_WARNING
static int flag_print_warnings = 1;

Expand All @@ -845,16 +857,12 @@ static inline int need_print_warning(struct dquot *dquot)
}

/* Print warning to user which exceeded quota */
static void print_warning(struct dquot *dquot, const char warntype)
static void print_warning(struct dquot *dquot, const int warntype)
{
char *msg = NULL;
struct tty_struct *tty;
int flag = (warntype == QUOTA_NL_BHARDWARN ||
warntype == QUOTA_NL_BSOFTLONGWARN) ? DQ_BLKS_B :
((warntype == QUOTA_NL_IHARDWARN ||
warntype == QUOTA_NL_ISOFTLONGWARN) ? DQ_INODES_B : 0);

if (!need_print_warning(dquot) || (flag && test_and_set_bit(flag, &dquot->dq_flags)))
if (!need_print_warning(dquot))
return;

mutex_lock(&tty_mutex);
Expand Down Expand Up @@ -969,7 +977,8 @@ static inline void flush_warnings(struct dquot * const *dquots, char *warntype)
int i;

for (i = 0; i < MAXQUOTAS; i++)
if (dquots[i] != NODQUOT && warntype[i] != QUOTA_NL_NOWARN) {
if (dquots[i] != NODQUOT && warntype[i] != QUOTA_NL_NOWARN &&
!warning_issued(dquots[i], warntype[i])) {
#ifdef CONFIG_PRINT_QUOTA_WARNING
print_warning(dquots[i], warntype[i]);
#endif
Expand Down

0 comments on commit 38ec28d

Please sign in to comment.