Commit dcf975d58565880a134afb13bde511d1b873ce79

Authored by H Hartley Sweeten
Committed by Linus Torvalds
1 parent 78dc583d3a

mm/page-writeback.c: dirty limit type should be unsigned long

get_dirty_limits() calls clip_bdi_dirty_limit() and task_dirty_limit()
with variable pbdi_dirty as one of the arguments.  This variable is an
unsigned long * but both functions expect it to be a long *.  This causes
the following sparse warnings:

  warning: incorrect type in argument 3 (different signedness)
     expected long *pbdi_dirty
     got unsigned long *pbdi_dirty
  warning: incorrect type in argument 2 (different signedness)
     expected long *pdirty
     got unsigned long *pbdi_dirty

Fix the warnings by changing the long * to unsigned long * in both
functions.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Showing 1 changed file with 10 additions and 9 deletions Side-by-side Diff

... ... @@ -265,18 +265,19 @@
265 265 * This avoids exceeding the total dirty_limit when the floating averages
266 266 * fluctuate too quickly.
267 267 */
268   -static void
269   -clip_bdi_dirty_limit(struct backing_dev_info *bdi, long dirty, long *pbdi_dirty)
  268 +static void clip_bdi_dirty_limit(struct backing_dev_info *bdi,
  269 + unsigned long dirty, unsigned long *pbdi_dirty)
270 270 {
271   - long avail_dirty;
  271 + unsigned long avail_dirty;
272 272  
273   - avail_dirty = dirty -
274   - (global_page_state(NR_FILE_DIRTY) +
  273 + avail_dirty = global_page_state(NR_FILE_DIRTY) +
275 274 global_page_state(NR_WRITEBACK) +
276 275 global_page_state(NR_UNSTABLE_NFS) +
277   - global_page_state(NR_WRITEBACK_TEMP));
  276 + global_page_state(NR_WRITEBACK_TEMP);
278 277  
279   - if (avail_dirty < 0)
  278 + if (avail_dirty < dirty)
  279 + avail_dirty = dirty - avail_dirty;
  280 + else
280 281 avail_dirty = 0;
281 282  
282 283 avail_dirty += bdi_stat(bdi, BDI_RECLAIMABLE) +
283 284  
... ... @@ -299,10 +300,10 @@
299 300 *
300 301 * dirty -= (dirty/8) * p_{t}
301 302 */
302   -static void task_dirty_limit(struct task_struct *tsk, long *pdirty)
  303 +static void task_dirty_limit(struct task_struct *tsk, unsigned long *pdirty)
303 304 {
304 305 long numerator, denominator;
305   - long dirty = *pdirty;
  306 + unsigned long dirty = *pdirty;
306 307 u64 inv = dirty >> 3;
307 308  
308 309 task_dirties_fraction(tsk, &numerator, &denominator);