| [RFC 4/7] move res_counter_set limit to res_counter.c [message #45714 is a reply to message #45710] | 
			Fri, 30 March 2012 08:04    | 
		 
		
			
				
				
				
					
						  
						Glauber Costa
						 Messages: 916 Registered: October 2011 
						
					 | 
					Senior Member  | 
					 | 
		 
		 
	 | 
 
	
		Preparation patch. Function is about to get complication to be 
inline. Move it to the main file for consistency. 
 
Signed-off-by: Glauber Costa <glommer@parallels.com> 
--- 
 include/linux/res_counter.h |   17 ++--------------- 
 kernel/res_counter.c        |   14 ++++++++++++++ 
 2 files changed, 16 insertions(+), 15 deletions(-) 
 
diff --git a/include/linux/res_counter.h b/include/linux/res_counter.h 
index d4f3674..53b271c 100644 
--- a/include/linux/res_counter.h 
+++ b/include/linux/res_counter.h 
@@ -188,21 +188,8 @@ static inline void res_counter_reset_failcnt(struct res_counter *cnt) 
 	raw_spin_unlock_irqrestore(&cnt->usage_pcp.lock, flags); 
 } 
  
-static inline int res_counter_set_limit(struct res_counter *cnt, 
-		unsigned long long limit) 
-{ 
-	unsigned long flags; 
-	int ret = -EBUSY; 
- 
-	raw_spin_lock_irqsave(&cnt->usage_pcp.lock, flags); 
-	if (cnt->usage <= limit) { 
-		cnt->limit = limit; 
-		ret = 0; 
-	} 
-	raw_spin_unlock_irqrestore(&cnt->usage_pcp.lock, flags); 
-	return ret; 
-} 
- 
+int res_counter_set_limit(struct res_counter *cnt, 
+			  unsigned long long limit); 
 static inline int 
 res_counter_set_soft_limit(struct res_counter *cnt, 
 				unsigned long long soft_limit) 
diff --git a/kernel/res_counter.c b/kernel/res_counter.c 
index 70c46c9..052efaf 100644 
--- a/kernel/res_counter.c 
+++ b/kernel/res_counter.c 
@@ -111,6 +111,20 @@ void res_counter_uncharge(struct res_counter *counter, unsigned long val) 
 	local_irq_restore(flags); 
 } 
  
+int res_counter_set_limit(struct res_counter *cnt, 
+			  unsigned long long limit) 
+{ 
+	unsigned long flags; 
+	int ret = -EBUSY; 
+ 
+	raw_spin_lock_irqsave(&cnt->usage_pcp.lock, flags); 
+	if (cnt->usage <= limit) { 
+		cnt->limit = limit; 
+		ret = 0; 
+	} 
+	raw_spin_unlock_irqrestore(&cnt->usage_pcp.lock, flags); 
+	return ret; 
+} 
  
 static inline unsigned long long * 
 res_counter_member(struct res_counter *counter, int member) 
--  
1.7.4.1
		
		
		
 |  
	| 
		
	 | 
 
 
 |