Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 105910
b: refs/heads/master
c: 12b9804
h: refs/heads/master
v: v3
  • Loading branch information
KAMEZAWA Hiroyuki authored and Linus Torvalds committed Jul 25, 2008
1 parent 51078ab commit 7216f23
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: cede86acd8bd5d2205dec28db8ac86410a3a19e8
refs/heads/master: 12b9804419cfb1c1bdac413f6c373af3b88d154b
16 changes: 16 additions & 0 deletions trunk/include/linux/res_counter.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,4 +158,20 @@ static inline void res_counter_reset_failcnt(struct res_counter *cnt)
cnt->failcnt = 0;
spin_unlock_irqrestore(&cnt->lock, flags);
}

static inline int res_counter_set_limit(struct res_counter *cnt,
unsigned long long limit)
{
unsigned long flags;
int ret = -EBUSY;

spin_lock_irqsave(&cnt->lock, flags);
if (cnt->usage < limit) {
cnt->limit = limit;
ret = 0;
}
spin_unlock_irqrestore(&cnt->lock, flags);
return ret;
}

#endif

0 comments on commit 7216f23

Please sign in to comment.