diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/afs/file.c | 4 | ||||
-rw-r--r-- | fs/binfmt_aout.c | 1 | ||||
-rw-r--r-- | fs/binfmt_elf.c | 1 | ||||
-rw-r--r-- | fs/binfmt_elf_fdpic.c | 7 | ||||
-rw-r--r-- | fs/binfmt_flat.c | 1 | ||||
-rw-r--r-- | fs/binfmt_som.c | 1 | ||||
-rw-r--r-- | fs/buffer.c | 2 | ||||
-rw-r--r-- | fs/coda/psdev.c | 4 | ||||
-rw-r--r-- | fs/compat.c | 1 | ||||
-rw-r--r-- | fs/compat_ioctl.c | 1 | ||||
-rw-r--r-- | fs/direct-io.c | 4 | ||||
-rw-r--r-- | fs/exec.c | 17 | ||||
-rw-r--r-- | fs/ext3/super.c | 26 | ||||
-rw-r--r-- | fs/hugetlbfs/inode.c | 206 | ||||
-rw-r--r-- | fs/jfs/jfs_dmap.c | 20 | ||||
-rw-r--r-- | fs/jfs/jfs_imap.c | 10 | ||||
-rw-r--r-- | fs/jfs/jfs_metapage.c | 18 | ||||
-rw-r--r-- | fs/jfs/jfs_txnmgr.c | 2 | ||||
-rw-r--r-- | fs/jfs/jfs_xtree.c | 18 | ||||
-rw-r--r-- | fs/jfs/super.c | 1 | ||||
-rw-r--r-- | fs/partitions/check.c | 27 | ||||
-rw-r--r-- | fs/proc/array.c | 2 | ||||
-rw-r--r-- | fs/proc/task_mmu.c | 51 | ||||
-rw-r--r-- | fs/xfs/linux-2.6/xfs_buf.c | 7 |
24 files changed, 257 insertions, 175 deletions
diff --git a/fs/afs/file.c b/fs/afs/file.c index 0d576987ec67..4975c9c193dd 100644 --- a/fs/afs/file.c +++ b/fs/afs/file.c | |||
@@ -291,8 +291,8 @@ static int afs_file_releasepage(struct page *page, gfp_t gfp_flags) | |||
291 | cachefs_uncache_page(vnode->cache, page); | 291 | cachefs_uncache_page(vnode->cache, page); |
292 | #endif | 292 | #endif |
293 | 293 | ||
294 | pageio = (struct cachefs_page *) page->private; | 294 | pageio = (struct cachefs_page *) page_private(page); |
295 | page->private = 0; | 295 | set_page_private(page, 0); |
296 | ClearPagePrivate(page); | 296 | ClearPagePrivate(page); |
297 | 297 | ||
298 | if (pageio) | 298 | if (pageio) |
diff --git a/fs/binfmt_aout.c b/fs/binfmt_aout.c index dd9baabaf016..72011826f0cb 100644 --- a/fs/binfmt_aout.c +++ b/fs/binfmt_aout.c | |||
@@ -318,7 +318,6 @@ static int load_aout_binary(struct linux_binprm * bprm, struct pt_regs * regs) | |||
318 | current->mm->free_area_cache = current->mm->mmap_base; | 318 | current->mm->free_area_cache = current->mm->mmap_base; |
319 | current->mm->cached_hole_size = 0; | 319 | current->mm->cached_hole_size = 0; |
320 | 320 | ||
321 | set_mm_counter(current->mm, rss, 0); | ||
322 | current->mm->mmap = NULL; | 321 | current->mm->mmap = NULL; |
323 | compute_creds(bprm); | 322 | compute_creds(bprm); |
324 | current->flags &= ~PF_FORKNOEXEC; | 323 | current->flags &= ~PF_FORKNOEXEC; |
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c index d4b15576e584..918ccc267e41 100644 --- a/fs/binfmt_elf.c +++ b/fs/binfmt_elf.c | |||
@@ -773,7 +773,6 @@ static int load_elf_binary(struct linux_binprm * bprm, struct pt_regs * regs) | |||
773 | 773 | ||
774 | /* Do this so that we can load the interpreter, if need be. We will | 774 | /* Do this so that we can load the interpreter, if need be. We will |
775 | change some of these later */ | 775 | change some of these later */ |
776 | set_mm_counter(current->mm, rss, 0); | ||
777 | current->mm->free_area_cache = current->mm->mmap_base; | 776 | current->mm->free_area_cache = current->mm->mmap_base; |
778 | current->mm->cached_hole_size = 0; | 777 | current->mm->cached_hole_size = 0; |
779 | retval = setup_arg_pages(bprm, randomize_stack_top(STACK_TOP), | 778 | retval = setup_arg_pages(bprm, randomize_stack_top(STACK_TOP), |
diff --git a/fs/binfmt_elf_fdpic.c b/fs/binfmt_elf_fdpic.c index 134c9c0d1f54..dda87c4c82a3 100644 --- a/fs/binfmt_elf_fdpic.c +++ b/fs/binfmt_elf_fdpic.c | |||
@@ -294,14 +294,7 @@ static int load_elf_fdpic_binary(struct linux_binprm *bprm, struct pt_regs *regs | |||
294 | &interp_params, | 294 | &interp_params, |
295 | ¤t->mm->start_stack, | 295 | ¤t->mm->start_stack, |
296 | ¤t->mm->start_brk); | 296 | ¤t->mm->start_brk); |
297 | #endif | ||
298 | |||
299 | /* do this so that we can load the interpreter, if need be | ||
300 | * - we will change some of these later | ||
301 | */ | ||
302 | set_mm_counter(current->mm, rss, 0); | ||
303 | 297 | ||
304 | #ifdef CONFIG_MMU | ||
305 | retval = setup_arg_pages(bprm, current->mm->start_stack, executable_stack); | 298 | retval = setup_arg_pages(bprm, current->mm->start_stack, executable_stack); |
306 | if (retval < 0) { | 299 | if (retval < 0) { |
307 | send_sig(SIGKILL, current, 0); | 300 | send_sig(SIGKILL, current, 0); |
diff --git a/fs/binfmt_flat.c b/fs/binfmt_flat.c index 7974efa107bc..9d6625829b99 100644 --- a/fs/binfmt_flat.c +++ b/fs/binfmt_flat.c | |||
@@ -650,7 +650,6 @@ static int load_flat_file(struct linux_binprm * bprm, | |||
650 | current->mm->start_brk = datapos + data_len + bss_len; | 650 | current->mm->start_brk = datapos + data_len + bss_len; |
651 | current->mm->brk = (current->mm->start_brk + 3) & ~3; | 651 | current->mm->brk = (current->mm->start_brk + 3) & ~3; |
652 | current->mm->context.end_brk = memp + ksize((void *) memp) - stack_len; | 652 | current->mm->context.end_brk = memp + ksize((void *) memp) - stack_len; |
653 | set_mm_counter(current->mm, rss, 0); | ||
654 | } | 653 | } |
655 | 654 | ||
656 | if (flags & FLAT_FLAG_KTRACE) | 655 | if (flags & FLAT_FLAG_KTRACE) |
diff --git a/fs/binfmt_som.c b/fs/binfmt_som.c index 227a2682d2bf..00a91dc25d16 100644 --- a/fs/binfmt_som.c +++ b/fs/binfmt_som.c | |||
@@ -259,7 +259,6 @@ load_som_binary(struct linux_binprm * bprm, struct pt_regs * regs) | |||
259 | create_som_tables(bprm); | 259 | create_som_tables(bprm); |
260 | 260 | ||
261 | current->mm->start_stack = bprm->p; | 261 | current->mm->start_stack = bprm->p; |
262 | set_mm_counter(current->mm, rss, 0); | ||
263 | 262 | ||
264 | #if 0 | 263 | #if 0 |
265 | printk("(start_brk) %08lx\n" , (unsigned long) current->mm->start_brk); | 264 | printk("(start_brk) %08lx\n" , (unsigned long) current->mm->start_brk); |
diff --git a/fs/buffer.c b/fs/buffer.c index b1667986442f..2066e4cb700c 100644 --- a/fs/buffer.c +++ b/fs/buffer.c | |||
@@ -96,7 +96,7 @@ static void | |||
96 | __clear_page_buffers(struct page *page) | 96 | __clear_page_buffers(struct page *page) |
97 | { | 97 | { |
98 | ClearPagePrivate(page); | 98 | ClearPagePrivate(page); |
99 | page->private = 0; | 99 | set_page_private(page, 0); |
100 | page_cache_release(page); | 100 | page_cache_release(page); |
101 | } | 101 | } |
102 | 102 | ||
diff --git a/fs/coda/psdev.c b/fs/coda/psdev.c index 3d1cce3653b8..6a3df88accfe 100644 --- a/fs/coda/psdev.c +++ b/fs/coda/psdev.c | |||
@@ -370,8 +370,8 @@ static int init_coda_psdev(void) | |||
370 | } | 370 | } |
371 | devfs_mk_dir ("coda"); | 371 | devfs_mk_dir ("coda"); |
372 | for (i = 0; i < MAX_CODADEVS; i++) { | 372 | for (i = 0; i < MAX_CODADEVS; i++) { |
373 | class_device_create(coda_psdev_class, MKDEV(CODA_PSDEV_MAJOR,i), | 373 | class_device_create(coda_psdev_class, NULL, |
374 | NULL, "cfs%d", i); | 374 | MKDEV(CODA_PSDEV_MAJOR,i), NULL, "cfs%d", i); |
375 | err = devfs_mk_cdev(MKDEV(CODA_PSDEV_MAJOR, i), | 375 | err = devfs_mk_cdev(MKDEV(CODA_PSDEV_MAJOR, i), |
376 | S_IFCHR|S_IRUSR|S_IWUSR, "coda/%d", i); | 376 | S_IFCHR|S_IRUSR|S_IWUSR, "coda/%d", i); |
377 | if (err) | 377 | if (err) |
diff --git a/fs/compat.c b/fs/compat.c index a719e158e002..8e71cdbecc7c 100644 --- a/fs/compat.c +++ b/fs/compat.c | |||
@@ -1490,7 +1490,6 @@ int compat_do_execve(char * filename, | |||
1490 | /* execve success */ | 1490 | /* execve success */ |
1491 | security_bprm_free(bprm); | 1491 | security_bprm_free(bprm); |
1492 | acct_update_integrals(current); | 1492 | acct_update_integrals(current); |
1493 | update_mem_hiwater(current); | ||
1494 | kfree(bprm); | 1493 | kfree(bprm); |
1495 | return retval; | 1494 | return retval; |
1496 | } | 1495 | } |
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index e28a74203f3b..a327e03753ac 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c | |||
@@ -3050,6 +3050,7 @@ HANDLE_IOCTL(TIOCSSERIAL, serial_struct_ioctl) | |||
3050 | HANDLE_IOCTL(USBDEVFS_CONTROL32, do_usbdevfs_control) | 3050 | HANDLE_IOCTL(USBDEVFS_CONTROL32, do_usbdevfs_control) |
3051 | HANDLE_IOCTL(USBDEVFS_BULK32, do_usbdevfs_bulk) | 3051 | HANDLE_IOCTL(USBDEVFS_BULK32, do_usbdevfs_bulk) |
3052 | HANDLE_IOCTL(USBDEVFS_DISCSIGNAL32, do_usbdevfs_discsignal) | 3052 | HANDLE_IOCTL(USBDEVFS_DISCSIGNAL32, do_usbdevfs_discsignal) |
3053 | COMPATIBLE_IOCTL(USBDEVFS_IOCTL32) | ||
3053 | /* i2c */ | 3054 | /* i2c */ |
3054 | HANDLE_IOCTL(I2C_FUNCS, w_long) | 3055 | HANDLE_IOCTL(I2C_FUNCS, w_long) |
3055 | HANDLE_IOCTL(I2C_RDWR, do_i2c_rdwr_ioctl) | 3056 | HANDLE_IOCTL(I2C_RDWR, do_i2c_rdwr_ioctl) |
diff --git a/fs/direct-io.c b/fs/direct-io.c index 0d06097bc995..3931e7f1e6bf 100644 --- a/fs/direct-io.c +++ b/fs/direct-io.c | |||
@@ -162,6 +162,7 @@ static int dio_refill_pages(struct dio *dio) | |||
162 | up_read(¤t->mm->mmap_sem); | 162 | up_read(¤t->mm->mmap_sem); |
163 | 163 | ||
164 | if (ret < 0 && dio->blocks_available && (dio->rw == WRITE)) { | 164 | if (ret < 0 && dio->blocks_available && (dio->rw == WRITE)) { |
165 | struct page *page = ZERO_PAGE(dio->curr_user_address); | ||
165 | /* | 166 | /* |
166 | * A memory fault, but the filesystem has some outstanding | 167 | * A memory fault, but the filesystem has some outstanding |
167 | * mapped blocks. We need to use those blocks up to avoid | 168 | * mapped blocks. We need to use those blocks up to avoid |
@@ -169,7 +170,8 @@ static int dio_refill_pages(struct dio *dio) | |||
169 | */ | 170 | */ |
170 | if (dio->page_errors == 0) | 171 | if (dio->page_errors == 0) |
171 | dio->page_errors = ret; | 172 | dio->page_errors = ret; |
172 | dio->pages[0] = ZERO_PAGE(dio->curr_user_address); | 173 | page_cache_get(page); |
174 | dio->pages[0] = page; | ||
173 | dio->head = 0; | 175 | dio->head = 0; |
174 | dio->tail = 1; | 176 | dio->tail = 1; |
175 | ret = 0; | 177 | ret = 0; |
@@ -309,40 +309,36 @@ void install_arg_page(struct vm_area_struct *vma, | |||
309 | pud_t * pud; | 309 | pud_t * pud; |
310 | pmd_t * pmd; | 310 | pmd_t * pmd; |
311 | pte_t * pte; | 311 | pte_t * pte; |
312 | spinlock_t *ptl; | ||
312 | 313 | ||
313 | if (unlikely(anon_vma_prepare(vma))) | 314 | if (unlikely(anon_vma_prepare(vma))) |
314 | goto out_sig; | 315 | goto out; |
315 | 316 | ||
316 | flush_dcache_page(page); | 317 | flush_dcache_page(page); |
317 | pgd = pgd_offset(mm, address); | 318 | pgd = pgd_offset(mm, address); |
318 | |||
319 | spin_lock(&mm->page_table_lock); | ||
320 | pud = pud_alloc(mm, pgd, address); | 319 | pud = pud_alloc(mm, pgd, address); |
321 | if (!pud) | 320 | if (!pud) |
322 | goto out; | 321 | goto out; |
323 | pmd = pmd_alloc(mm, pud, address); | 322 | pmd = pmd_alloc(mm, pud, address); |
324 | if (!pmd) | 323 | if (!pmd) |
325 | goto out; | 324 | goto out; |
326 | pte = pte_alloc_map(mm, pmd, address); | 325 | pte = pte_alloc_map_lock(mm, pmd, address, &ptl); |
327 | if (!pte) | 326 | if (!pte) |
328 | goto out; | 327 | goto out; |
329 | if (!pte_none(*pte)) { | 328 | if (!pte_none(*pte)) { |
330 | pte_unmap(pte); | 329 | pte_unmap_unlock(pte, ptl); |
331 | goto out; | 330 | goto out; |
332 | } | 331 | } |
333 | inc_mm_counter(mm, rss); | 332 | inc_mm_counter(mm, anon_rss); |
334 | lru_cache_add_active(page); | 333 | lru_cache_add_active(page); |
335 | set_pte_at(mm, address, pte, pte_mkdirty(pte_mkwrite(mk_pte( | 334 | set_pte_at(mm, address, pte, pte_mkdirty(pte_mkwrite(mk_pte( |
336 | page, vma->vm_page_prot)))); | 335 | page, vma->vm_page_prot)))); |
337 | page_add_anon_rmap(page, vma, address); | 336 | page_add_anon_rmap(page, vma, address); |
338 | pte_unmap(pte); | 337 | pte_unmap_unlock(pte, ptl); |
339 | spin_unlock(&mm->page_table_lock); | ||
340 | 338 | ||
341 | /* no need for flush_tlb */ | 339 | /* no need for flush_tlb */ |
342 | return; | 340 | return; |
343 | out: | 341 | out: |
344 | spin_unlock(&mm->page_table_lock); | ||
345 | out_sig: | ||
346 | __free_page(page); | 342 | __free_page(page); |
347 | force_sig(SIGKILL, current); | 343 | force_sig(SIGKILL, current); |
348 | } | 344 | } |
@@ -1207,7 +1203,6 @@ int do_execve(char * filename, | |||
1207 | /* execve success */ | 1203 | /* execve success */ |
1208 | security_bprm_free(bprm); | 1204 | security_bprm_free(bprm); |
1209 | acct_update_integrals(current); | 1205 | acct_update_integrals(current); |
1210 | update_mem_hiwater(current); | ||
1211 | kfree(bprm); | 1206 | kfree(bprm); |
1212 | return retval; | 1207 | return retval; |
1213 | } | 1208 | } |
diff --git a/fs/ext3/super.c b/fs/ext3/super.c index 9e24ceb019fe..097383c11154 100644 --- a/fs/ext3/super.c +++ b/fs/ext3/super.c | |||
@@ -510,19 +510,11 @@ static void ext3_clear_inode(struct inode *inode) | |||
510 | kfree(rsv); | 510 | kfree(rsv); |
511 | } | 511 | } |
512 | 512 | ||
513 | static int ext3_show_options(struct seq_file *seq, struct vfsmount *vfs) | 513 | static inline void ext3_show_quota_options(struct seq_file *seq, struct super_block *sb) |
514 | { | 514 | { |
515 | struct super_block *sb = vfs->mnt_sb; | 515 | #if defined(CONFIG_QUOTA) |
516 | struct ext3_sb_info *sbi = EXT3_SB(sb); | 516 | struct ext3_sb_info *sbi = EXT3_SB(sb); |
517 | 517 | ||
518 | if (test_opt(sb, DATA_FLAGS) == EXT3_MOUNT_JOURNAL_DATA) | ||
519 | seq_puts(seq, ",data=journal"); | ||
520 | else if (test_opt(sb, DATA_FLAGS) == EXT3_MOUNT_ORDERED_DATA) | ||
521 | seq_puts(seq, ",data=ordered"); | ||
522 | else if (test_opt(sb, DATA_FLAGS) == EXT3_MOUNT_WRITEBACK_DATA) | ||
523 | seq_puts(seq, ",data=writeback"); | ||
524 | |||
525 | #if defined(CONFIG_QUOTA) | ||
526 | if (sbi->s_jquota_fmt) | 518 | if (sbi->s_jquota_fmt) |
527 | seq_printf(seq, ",jqfmt=%s", | 519 | seq_printf(seq, ",jqfmt=%s", |
528 | (sbi->s_jquota_fmt == QFMT_VFS_OLD) ? "vfsold": "vfsv0"); | 520 | (sbi->s_jquota_fmt == QFMT_VFS_OLD) ? "vfsold": "vfsv0"); |
@@ -539,6 +531,20 @@ static int ext3_show_options(struct seq_file *seq, struct vfsmount *vfs) | |||
539 | if (sbi->s_mount_opt & EXT3_MOUNT_GRPQUOTA) | 531 | if (sbi->s_mount_opt & EXT3_MOUNT_GRPQUOTA) |
540 | seq_puts(seq, ",grpquota"); | 532 | seq_puts(seq, ",grpquota"); |
541 | #endif | 533 | #endif |
534 | } | ||
535 | |||
536 | static int ext3_show_options(struct seq_file *seq, struct vfsmount *vfs) | ||
537 | { | ||
538 | struct super_block *sb = vfs->mnt_sb; | ||
539 | |||
540 | if (test_opt(sb, DATA_FLAGS) == EXT3_MOUNT_JOURNAL_DATA) | ||
541 | seq_puts(seq, ",data=journal"); | ||
542 | else if (test_opt(sb, DATA_FLAGS) == EXT3_MOUNT_ORDERED_DATA) | ||
543 | seq_puts(seq, ",data=ordered"); | ||
544 | else if (test_opt(sb, DATA_FLAGS) == EXT3_MOUNT_WRITEBACK_DATA) | ||
545 | seq_puts(seq, ",data=writeback"); | ||
546 | |||
547 | ext3_show_quota_options(seq, sb); | ||
542 | 548 | ||
543 | return 0; | 549 | return 0; |
544 | } | 550 | } |
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index 3a9b6d179cbd..e026c807e6b3 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c | |||
@@ -45,10 +45,58 @@ static struct backing_dev_info hugetlbfs_backing_dev_info = { | |||
45 | 45 | ||
46 | int sysctl_hugetlb_shm_group; | 46 | int sysctl_hugetlb_shm_group; |
47 | 47 | ||
48 | static void huge_pagevec_release(struct pagevec *pvec) | ||
49 | { | ||
50 | int i; | ||
51 | |||
52 | for (i = 0; i < pagevec_count(pvec); ++i) | ||
53 | put_page(pvec->pages[i]); | ||
54 | |||
55 | pagevec_reinit(pvec); | ||
56 | } | ||
57 | |||
58 | /* | ||
59 | * huge_pages_needed tries to determine the number of new huge pages that | ||
60 | * will be required to fully populate this VMA. This will be equal to | ||
61 | * the size of the VMA in huge pages minus the number of huge pages | ||
62 | * (covered by this VMA) that are found in the page cache. | ||
63 | * | ||
64 | * Result is in bytes to be compatible with is_hugepage_mem_enough() | ||
65 | */ | ||
66 | unsigned long | ||
67 | huge_pages_needed(struct address_space *mapping, struct vm_area_struct *vma) | ||
68 | { | ||
69 | int i; | ||
70 | struct pagevec pvec; | ||
71 | unsigned long start = vma->vm_start; | ||
72 | unsigned long end = vma->vm_end; | ||
73 | unsigned long hugepages = (end - start) >> HPAGE_SHIFT; | ||
74 | pgoff_t next = vma->vm_pgoff; | ||
75 | pgoff_t endpg = next + ((end - start) >> PAGE_SHIFT); | ||
76 | |||
77 | pagevec_init(&pvec, 0); | ||
78 | while (next < endpg) { | ||
79 | if (!pagevec_lookup(&pvec, mapping, next, PAGEVEC_SIZE)) | ||
80 | break; | ||
81 | for (i = 0; i < pagevec_count(&pvec); i++) { | ||
82 | struct page *page = pvec.pages[i]; | ||
83 | if (page->index > next) | ||
84 | next = page->index; | ||
85 | if (page->index >= endpg) | ||
86 | break; | ||
87 | next++; | ||
88 | hugepages--; | ||
89 | } | ||
90 | huge_pagevec_release(&pvec); | ||
91 | } | ||
92 | return hugepages << HPAGE_SHIFT; | ||
93 | } | ||
94 | |||
48 | static int hugetlbfs_file_mmap(struct file *file, struct vm_area_struct *vma) | 95 | static int hugetlbfs_file_mmap(struct file *file, struct vm_area_struct *vma) |
49 | { | 96 | { |
50 | struct inode *inode = file->f_dentry->d_inode; | 97 | struct inode *inode = file->f_dentry->d_inode; |
51 | struct address_space *mapping = inode->i_mapping; | 98 | struct address_space *mapping = inode->i_mapping; |
99 | unsigned long bytes; | ||
52 | loff_t len, vma_len; | 100 | loff_t len, vma_len; |
53 | int ret; | 101 | int ret; |
54 | 102 | ||
@@ -67,6 +115,10 @@ static int hugetlbfs_file_mmap(struct file *file, struct vm_area_struct *vma) | |||
67 | if (vma->vm_end - vma->vm_start < HPAGE_SIZE) | 115 | if (vma->vm_end - vma->vm_start < HPAGE_SIZE) |
68 | return -EINVAL; | 116 | return -EINVAL; |
69 | 117 | ||
118 | bytes = huge_pages_needed(mapping, vma); | ||
119 | if (!is_hugepage_mem_enough(bytes)) | ||
120 | return -ENOMEM; | ||
121 | |||
70 | vma_len = (loff_t)(vma->vm_end - vma->vm_start); | 122 | vma_len = (loff_t)(vma->vm_end - vma->vm_start); |
71 | 123 | ||
72 | down(&inode->i_sem); | 124 | down(&inode->i_sem); |
@@ -79,10 +131,8 @@ static int hugetlbfs_file_mmap(struct file *file, struct vm_area_struct *vma) | |||
79 | if (!(vma->vm_flags & VM_WRITE) && len > inode->i_size) | 131 | if (!(vma->vm_flags & VM_WRITE) && len > inode->i_size) |
80 | goto out; | 132 | goto out; |
81 | 133 | ||
82 | ret = hugetlb_prefault(mapping, vma); | 134 | ret = 0; |
83 | if (ret) | 135 | hugetlb_prefault_arch_hook(vma->vm_mm); |
84 | goto out; | ||
85 | |||
86 | if (inode->i_size < len) | 136 | if (inode->i_size < len) |
87 | inode->i_size = len; | 137 | inode->i_size = len; |
88 | out: | 138 | out: |
@@ -92,7 +142,7 @@ out: | |||
92 | } | 142 | } |
93 | 143 | ||
94 | /* | 144 | /* |
95 | * Called under down_write(mmap_sem), page_table_lock is not held | 145 | * Called under down_write(mmap_sem). |
96 | */ | 146 | */ |
97 | 147 | ||
98 | #ifdef HAVE_ARCH_HUGETLB_UNMAPPED_AREA | 148 | #ifdef HAVE_ARCH_HUGETLB_UNMAPPED_AREA |
@@ -171,16 +221,6 @@ static int hugetlbfs_commit_write(struct file *file, | |||
171 | return -EINVAL; | 221 | return -EINVAL; |
172 | } | 222 | } |
173 | 223 | ||
174 | static void huge_pagevec_release(struct pagevec *pvec) | ||
175 | { | ||
176 | int i; | ||
177 | |||
178 | for (i = 0; i < pagevec_count(pvec); ++i) | ||
179 | put_page(pvec->pages[i]); | ||
180 | |||
181 | pagevec_reinit(pvec); | ||
182 | } | ||
183 | |||
184 | static void truncate_huge_page(struct page *page) | 224 | static void truncate_huge_page(struct page *page) |
185 | { | 225 | { |
186 | clear_page_dirty(page); | 226 | clear_page_dirty(page); |
@@ -224,52 +264,35 @@ static void truncate_hugepages(struct address_space *mapping, loff_t lstart) | |||
224 | 264 | ||
225 | static void hugetlbfs_delete_inode(struct inode *inode) | 265 | static void hugetlbfs_delete_inode(struct inode *inode) |
226 | { | 266 | { |
227 | struct hugetlbfs_sb_info *sbinfo = HUGETLBFS_SB(inode->i_sb); | ||
228 | |||
229 | hlist_del_init(&inode->i_hash); | ||
230 | list_del_init(&inode->i_list); | ||
231 | list_del_init(&inode->i_sb_list); | ||
232 | inode->i_state |= I_FREEING; | ||
233 | inodes_stat.nr_inodes--; | ||
234 | spin_unlock(&inode_lock); | ||
235 | |||
236 | if (inode->i_data.nrpages) | 267 | if (inode->i_data.nrpages) |
237 | truncate_hugepages(&inode->i_data, 0); | 268 | truncate_hugepages(&inode->i_data, 0); |
238 | |||
239 | security_inode_delete(inode); | ||
240 | |||
241 | if (sbinfo->free_inodes >= 0) { | ||
242 | spin_lock(&sbinfo->stat_lock); | ||
243 | sbinfo->free_inodes++; | ||
244 | spin_unlock(&sbinfo->stat_lock); | ||
245 | } | ||
246 | |||
247 | clear_inode(inode); | 269 | clear_inode(inode); |
248 | destroy_inode(inode); | ||
249 | } | 270 | } |
250 | 271 | ||
251 | static void hugetlbfs_forget_inode(struct inode *inode) | 272 | static void hugetlbfs_forget_inode(struct inode *inode) |
252 | { | 273 | { |
253 | struct super_block *super_block = inode->i_sb; | 274 | struct super_block *sb = inode->i_sb; |
254 | struct hugetlbfs_sb_info *sbinfo = HUGETLBFS_SB(super_block); | ||
255 | 275 | ||
256 | if (hlist_unhashed(&inode->i_hash)) | 276 | if (!hlist_unhashed(&inode->i_hash)) { |
257 | goto out_truncate; | 277 | if (!(inode->i_state & (I_DIRTY|I_LOCK))) |
258 | 278 | list_move(&inode->i_list, &inode_unused); | |
259 | if (!(inode->i_state & (I_DIRTY|I_LOCK))) { | 279 | inodes_stat.nr_unused++; |
260 | list_del(&inode->i_list); | 280 | if (!sb || (sb->s_flags & MS_ACTIVE)) { |
261 | list_add(&inode->i_list, &inode_unused); | 281 | spin_unlock(&inode_lock); |
262 | } | 282 | return; |
263 | inodes_stat.nr_unused++; | 283 | } |
264 | if (!super_block || (super_block->s_flags & MS_ACTIVE)) { | 284 | inode->i_state |= I_WILL_FREE; |
265 | spin_unlock(&inode_lock); | 285 | spin_unlock(&inode_lock); |
266 | return; | 286 | /* |
287 | * write_inode_now is a noop as we set BDI_CAP_NO_WRITEBACK | ||
288 | * in our backing_dev_info. | ||
289 | */ | ||
290 | write_inode_now(inode, 1); | ||
291 | spin_lock(&inode_lock); | ||
292 | inode->i_state &= ~I_WILL_FREE; | ||
293 | inodes_stat.nr_unused--; | ||
294 | hlist_del_init(&inode->i_hash); | ||
267 | } | 295 | } |
268 | |||
269 | /* write_inode_now() ? */ | ||
270 | inodes_stat.nr_unused--; | ||
271 | hlist_del_init(&inode->i_hash); | ||
272 | out_truncate: | ||
273 | list_del_init(&inode->i_list); | 296 | list_del_init(&inode->i_list); |
274 | list_del_init(&inode->i_sb_list); | 297 | list_del_init(&inode->i_sb_list); |
275 | inode->i_state |= I_FREEING; | 298 | inode->i_state |= I_FREEING; |
@@ -277,13 +300,6 @@ out_truncate: | |||
277 | spin_unlock(&inode_lock); | 300 | spin_unlock(&inode_lock); |
278 | if (inode->i_data.nrpages) | 301 | if (inode->i_data.nrpages) |
279 | truncate_hugepages(&inode->i_data, 0); | 302 | truncate_hugepages(&inode->i_data, 0); |
280 | |||
281 | if (sbinfo->free_inodes >= 0) { | ||
282 | spin_lock(&sbinfo->stat_lock); | ||
283 | sbinfo->free_inodes++; | ||
284 | spin_unlock(&sbinfo->stat_lock); | ||
285 | } | ||
286 | |||
287 | clear_inode(inode); | 303 | clear_inode(inode); |
288 | destroy_inode(inode); | 304 | destroy_inode(inode); |
289 | } | 305 | } |
@@ -291,7 +307,7 @@ out_truncate: | |||
291 | static void hugetlbfs_drop_inode(struct inode *inode) | 307 | static void hugetlbfs_drop_inode(struct inode *inode) |
292 | { | 308 | { |
293 | if (!inode->i_nlink) | 309 | if (!inode->i_nlink) |
294 | hugetlbfs_delete_inode(inode); | 310 | generic_delete_inode(inode); |
295 | else | 311 | else |
296 | hugetlbfs_forget_inode(inode); | 312 | hugetlbfs_forget_inode(inode); |
297 | } | 313 | } |
@@ -308,7 +324,6 @@ hugetlb_vmtruncate_list(struct prio_tree_root *root, unsigned long h_pgoff) | |||
308 | 324 | ||
309 | vma_prio_tree_foreach(vma, &iter, root, h_pgoff, ULONG_MAX) { | 325 | vma_prio_tree_foreach(vma, &iter, root, h_pgoff, ULONG_MAX) { |
310 | unsigned long h_vm_pgoff; | 326 | unsigned long h_vm_pgoff; |
311 | unsigned long v_length; | ||
312 | unsigned long v_offset; | 327 | unsigned long v_offset; |
313 | 328 | ||
314 | h_vm_pgoff = vma->vm_pgoff >> (HPAGE_SHIFT - PAGE_SHIFT); | 329 | h_vm_pgoff = vma->vm_pgoff >> (HPAGE_SHIFT - PAGE_SHIFT); |
@@ -319,11 +334,8 @@ hugetlb_vmtruncate_list(struct prio_tree_root *root, unsigned long h_pgoff) | |||
319 | if (h_vm_pgoff >= h_pgoff) | 334 | if (h_vm_pgoff >= h_pgoff) |
320 | v_offset = 0; | 335 | v_offset = 0; |
321 | 336 | ||
322 | v_length = vma->vm_end - vma->vm_start; | 337 | unmap_hugepage_range(vma, |
323 | 338 | vma->vm_start + v_offset, vma->vm_end); | |
324 | zap_hugepage_range(vma, | ||
325 | vma->vm_start + v_offset, | ||
326 | v_length - v_offset); | ||
327 | } | 339 | } |
328 | } | 340 | } |
329 | 341 | ||
@@ -379,17 +391,6 @@ static struct inode *hugetlbfs_get_inode(struct super_block *sb, uid_t uid, | |||
379 | gid_t gid, int mode, dev_t dev) | 391 | gid_t gid, int mode, dev_t dev) |
380 | { | 392 | { |
381 | struct inode *inode; | 393 | struct inode *inode; |
382 | struct hugetlbfs_sb_info *sbinfo = HUGETLBFS_SB(sb); | ||
383 | |||
384 | if (sbinfo->free_inodes >= 0) { | ||
385 | spin_lock(&sbinfo->stat_lock); | ||
386 | if (!sbinfo->free_inodes) { | ||
387 | spin_unlock(&sbinfo->stat_lock); | ||
388 | return NULL; | ||
389 | } | ||
390 | sbinfo->free_inodes--; | ||
391 | spin_unlock(&sbinfo->stat_lock); | ||
392 | } | ||
393 | 394 | ||
394 | inode = new_inode(sb); | 395 | inode = new_inode(sb); |
395 | if (inode) { | 396 | if (inode) { |
@@ -531,29 +532,51 @@ static void hugetlbfs_put_super(struct super_block *sb) | |||
531 | } | 532 | } |
532 | } | 533 | } |
533 | 534 | ||
535 | static inline int hugetlbfs_dec_free_inodes(struct hugetlbfs_sb_info *sbinfo) | ||
536 | { | ||
537 | if (sbinfo->free_inodes >= 0) { | ||
538 | spin_lock(&sbinfo->stat_lock); | ||
539 | if (unlikely(!sbinfo->free_inodes)) { | ||
540 | spin_unlock(&sbinfo->stat_lock); | ||
541 | return 0; | ||
542 | } | ||
543 | sbinfo->free_inodes--; | ||
544 | spin_unlock(&sbinfo->stat_lock); | ||
545 | } | ||
546 | |||
547 | return 1; | ||
548 | } | ||
549 | |||
550 | static void hugetlbfs_inc_free_inodes(struct hugetlbfs_sb_info *sbinfo) | ||
551 | { | ||
552 | if (sbinfo->free_inodes >= 0) { | ||
553 | spin_lock(&sbinfo->stat_lock); | ||
554 | sbinfo->free_inodes++; | ||
555 | spin_unlock(&sbinfo->stat_lock); | ||
556 | } | ||
557 | } | ||
558 | |||
559 | |||
534 | static kmem_cache_t *hugetlbfs_inode_cachep; | 560 | static kmem_cache_t *hugetlbfs_inode_cachep; |
535 | 561 | ||
536 | static struct inode *hugetlbfs_alloc_inode(struct super_block *sb) | 562 | static struct inode *hugetlbfs_alloc_inode(struct super_block *sb) |
537 | { | 563 | { |
564 | struct hugetlbfs_sb_info *sbinfo = HUGETLBFS_SB(sb); | ||
538 | struct hugetlbfs_inode_info *p; | 565 | struct hugetlbfs_inode_info *p; |
539 | 566 | ||
567 | if (unlikely(!hugetlbfs_dec_free_inodes(sbinfo))) | ||
568 | return NULL; | ||
540 | p = kmem_cache_alloc(hugetlbfs_inode_cachep, SLAB_KERNEL); | 569 | p = kmem_cache_alloc(hugetlbfs_inode_cachep, SLAB_KERNEL); |
541 | if (!p) | 570 | if (unlikely(!p)) { |
571 | hugetlbfs_inc_free_inodes(sbinfo); | ||
542 | return NULL; | 572 | return NULL; |
573 | } | ||
543 | return &p->vfs_inode; | 574 | return &p->vfs_inode; |
544 | } | 575 | } |
545 | 576 | ||
546 | static void init_once(void *foo, kmem_cache_t *cachep, unsigned long flags) | ||
547 | { | ||
548 | struct hugetlbfs_inode_info *ei = (struct hugetlbfs_inode_info *)foo; | ||
549 | |||
550 | if ((flags & (SLAB_CTOR_VERIFY|SLAB_CTOR_CONSTRUCTOR)) == | ||
551 | SLAB_CTOR_CONSTRUCTOR) | ||
552 | inode_init_once(&ei->vfs_inode); | ||
553 | } | ||
554 | |||
555 | static void hugetlbfs_destroy_inode(struct inode *inode) | 577 | static void hugetlbfs_destroy_inode(struct inode *inode) |
556 | { | 578 | { |
579 | hugetlbfs_inc_free_inodes(HUGETLBFS_SB(inode->i_sb)); | ||
557 | mpol_free_shared_policy(&HUGETLBFS_I(inode)->policy); | 580 | mpol_free_shared_policy(&HUGETLBFS_I(inode)->policy); |
558 | kmem_cache_free(hugetlbfs_inode_cachep, HUGETLBFS_I(inode)); | 581 | kmem_cache_free(hugetlbfs_inode_cachep, HUGETLBFS_I(inode)); |
559 | } | 582 | } |
@@ -565,6 +588,16 @@ static struct address_space_operations hugetlbfs_aops = { | |||
565 | .set_page_dirty = hugetlbfs_set_page_dirty, | 588 | .set_page_dirty = hugetlbfs_set_page_dirty, |
566 | }; | 589 | }; |
567 | 590 | ||
591 | |||
592 | static void init_once(void *foo, kmem_cache_t *cachep, unsigned long flags) | ||
593 | { | ||
594 | struct hugetlbfs_inode_info *ei = (struct hugetlbfs_inode_info *)foo; | ||
595 | |||
596 | if ((flags & (SLAB_CTOR_VERIFY|SLAB_CTOR_CONSTRUCTOR)) == | ||
597 | SLAB_CTOR_CONSTRUCTOR) | ||
598 | inode_init_once(&ei->vfs_inode); | ||
599 | } | ||
600 | |||
568 | struct file_operations hugetlbfs_file_operations = { | 601 | struct file_operations hugetlbfs_file_operations = { |
569 | .mmap = hugetlbfs_file_mmap, | 602 | .mmap = hugetlbfs_file_mmap, |
570 | .fsync = simple_sync_file, | 603 | .fsync = simple_sync_file, |
@@ -592,6 +625,7 @@ static struct super_operations hugetlbfs_ops = { | |||
592 | .alloc_inode = hugetlbfs_alloc_inode, | 625 | .alloc_inode = hugetlbfs_alloc_inode, |
593 | .destroy_inode = hugetlbfs_destroy_inode, | 626 | .destroy_inode = hugetlbfs_destroy_inode, |
594 | .statfs = hugetlbfs_statfs, | 627 | .statfs = hugetlbfs_statfs, |
628 | .delete_inode = hugetlbfs_delete_inode, | ||
595 | .drop_inode = hugetlbfs_drop_inode, | 629 | .drop_inode = hugetlbfs_drop_inode, |
596 | .put_super = hugetlbfs_put_super, | 630 | .put_super = hugetlbfs_put_super, |
597 | }; | 631 | }; |
diff --git a/fs/jfs/jfs_dmap.c b/fs/jfs/jfs_dmap.c index eadf319bee22..68000a50ceb6 100644 --- a/fs/jfs/jfs_dmap.c +++ b/fs/jfs/jfs_dmap.c | |||
@@ -74,7 +74,7 @@ | |||
74 | static void dbAllocBits(struct bmap * bmp, struct dmap * dp, s64 blkno, | 74 | static void dbAllocBits(struct bmap * bmp, struct dmap * dp, s64 blkno, |
75 | int nblocks); | 75 | int nblocks); |
76 | static void dbSplit(dmtree_t * tp, int leafno, int splitsz, int newval); | 76 | static void dbSplit(dmtree_t * tp, int leafno, int splitsz, int newval); |
77 | static void dbBackSplit(dmtree_t * tp, int leafno); | 77 | static int dbBackSplit(dmtree_t * tp, int leafno); |
78 | static int dbJoin(dmtree_t * tp, int leafno, int newval); | 78 | static int dbJoin(dmtree_t * tp, int leafno, int newval); |
79 | static void dbAdjTree(dmtree_t * tp, int leafno, int newval); | 79 | static void dbAdjTree(dmtree_t * tp, int leafno, int newval); |
80 | static int dbAdjCtl(struct bmap * bmp, s64 blkno, int newval, int alloc, | 80 | static int dbAdjCtl(struct bmap * bmp, s64 blkno, int newval, int alloc, |
@@ -305,7 +305,6 @@ int dbSync(struct inode *ipbmap) | |||
305 | filemap_fdatawrite(ipbmap->i_mapping); | 305 | filemap_fdatawrite(ipbmap->i_mapping); |
306 | filemap_fdatawait(ipbmap->i_mapping); | 306 | filemap_fdatawait(ipbmap->i_mapping); |
307 | 307 | ||
308 | ipbmap->i_state |= I_DIRTY; | ||
309 | diWriteSpecial(ipbmap, 0); | 308 | diWriteSpecial(ipbmap, 0); |
310 | 309 | ||
311 | return (0); | 310 | return (0); |
@@ -2467,7 +2466,9 @@ dbAdjCtl(struct bmap * bmp, s64 blkno, int newval, int alloc, int level) | |||
2467 | * that it is at the front of a binary buddy system. | 2466 | * that it is at the front of a binary buddy system. |
2468 | */ | 2467 | */ |
2469 | if (oldval == NOFREE) { | 2468 | if (oldval == NOFREE) { |
2470 | dbBackSplit((dmtree_t *) dcp, leafno); | 2469 | rc = dbBackSplit((dmtree_t *) dcp, leafno); |
2470 | if (rc) | ||
2471 | return rc; | ||
2471 | oldval = dcp->stree[ti]; | 2472 | oldval = dcp->stree[ti]; |
2472 | } | 2473 | } |
2473 | dbSplit((dmtree_t *) dcp, leafno, dcp->budmin, newval); | 2474 | dbSplit((dmtree_t *) dcp, leafno, dcp->budmin, newval); |
@@ -2627,7 +2628,7 @@ static void dbSplit(dmtree_t * tp, int leafno, int splitsz, int newval) | |||
2627 | * | 2628 | * |
2628 | * serialization: IREAD_LOCK(ipbmap) or IWRITE_LOCK(ipbmap) held on entry/exit; | 2629 | * serialization: IREAD_LOCK(ipbmap) or IWRITE_LOCK(ipbmap) held on entry/exit; |
2629 | */ | 2630 | */ |
2630 | static void dbBackSplit(dmtree_t * tp, int leafno) | 2631 | static int dbBackSplit(dmtree_t * tp, int leafno) |
2631 | { | 2632 | { |
2632 | int budsz, bud, w, bsz, size; | 2633 | int budsz, bud, w, bsz, size; |
2633 | int cursz; | 2634 | int cursz; |
@@ -2662,7 +2663,10 @@ static void dbBackSplit(dmtree_t * tp, int leafno) | |||
2662 | */ | 2663 | */ |
2663 | for (w = leafno, bsz = budsz;; bsz <<= 1, | 2664 | for (w = leafno, bsz = budsz;; bsz <<= 1, |
2664 | w = (w < bud) ? w : bud) { | 2665 | w = (w < bud) ? w : bud) { |
2665 | assert(bsz < le32_to_cpu(tp->dmt_nleafs)); | 2666 | if (bsz >= le32_to_cpu(tp->dmt_nleafs)) { |
2667 | jfs_err("JFS: block map error in dbBackSplit"); | ||
2668 | return -EIO; | ||
2669 | } | ||
2666 | 2670 | ||
2667 | /* determine the buddy. | 2671 | /* determine the buddy. |
2668 | */ | 2672 | */ |
@@ -2681,7 +2685,11 @@ static void dbBackSplit(dmtree_t * tp, int leafno) | |||
2681 | } | 2685 | } |
2682 | } | 2686 | } |
2683 | 2687 | ||
2684 | assert(leaf[leafno] == size); | 2688 | if (leaf[leafno] != size) { |
2689 | jfs_err("JFS: wrong leaf value in dbBackSplit"); | ||
2690 | return -EIO; | ||
2691 | } | ||
2692 | return 0; | ||
2685 | } | 2693 | } |
2686 | 2694 | ||
2687 | 2695 | ||
diff --git a/fs/jfs/jfs_imap.c b/fs/jfs/jfs_imap.c index 4021d46da7e3..28201b194f53 100644 --- a/fs/jfs/jfs_imap.c +++ b/fs/jfs/jfs_imap.c | |||
@@ -57,6 +57,12 @@ | |||
57 | #include "jfs_debug.h" | 57 | #include "jfs_debug.h" |
58 | 58 | ||
59 | /* | 59 | /* |
60 | * __mark_inode_dirty expects inodes to be hashed. Since we don't want | ||
61 | * special inodes in the fileset inode space, we hash them to a dummy head | ||
62 | */ | ||
63 | static HLIST_HEAD(aggregate_hash); | ||
64 | |||
65 | /* | ||
60 | * imap locks | 66 | * imap locks |
61 | */ | 67 | */ |
62 | /* iag free list lock */ | 68 | /* iag free list lock */ |
@@ -491,6 +497,8 @@ struct inode *diReadSpecial(struct super_block *sb, ino_t inum, int secondary) | |||
491 | /* release the page */ | 497 | /* release the page */ |
492 | release_metapage(mp); | 498 | release_metapage(mp); |
493 | 499 | ||
500 | hlist_add_head(&ip->i_hash, &aggregate_hash); | ||
501 | |||
494 | return (ip); | 502 | return (ip); |
495 | } | 503 | } |
496 | 504 | ||
@@ -514,8 +522,6 @@ void diWriteSpecial(struct inode *ip, int secondary) | |||
514 | ino_t inum = ip->i_ino; | 522 | ino_t inum = ip->i_ino; |
515 | struct metapage *mp; | 523 | struct metapage *mp; |
516 | 524 | ||
517 | ip->i_state &= ~I_DIRTY; | ||
518 | |||
519 | if (secondary) | 525 | if (secondary) |
520 | address = addressPXD(&sbi->ait2) >> sbi->l2nbperpage; | 526 | address = addressPXD(&sbi->ait2) >> sbi->l2nbperpage; |
521 | else | 527 | else |
diff --git a/fs/jfs/jfs_metapage.c b/fs/jfs/jfs_metapage.c index eeb37d70e650..8a53981f9f27 100644 --- a/fs/jfs/jfs_metapage.c +++ b/fs/jfs/jfs_metapage.c | |||
@@ -86,7 +86,7 @@ struct meta_anchor { | |||
86 | atomic_t io_count; | 86 | atomic_t io_count; |
87 | struct metapage *mp[MPS_PER_PAGE]; | 87 | struct metapage *mp[MPS_PER_PAGE]; |
88 | }; | 88 | }; |
89 | #define mp_anchor(page) ((struct meta_anchor *)page->private) | 89 | #define mp_anchor(page) ((struct meta_anchor *)page_private(page)) |
90 | 90 | ||
91 | static inline struct metapage *page_to_mp(struct page *page, uint offset) | 91 | static inline struct metapage *page_to_mp(struct page *page, uint offset) |
92 | { | 92 | { |
@@ -108,7 +108,7 @@ static inline int insert_metapage(struct page *page, struct metapage *mp) | |||
108 | if (!a) | 108 | if (!a) |
109 | return -ENOMEM; | 109 | return -ENOMEM; |
110 | memset(a, 0, sizeof(struct meta_anchor)); | 110 | memset(a, 0, sizeof(struct meta_anchor)); |
111 | page->private = (unsigned long)a; | 111 | set_page_private(page, (unsigned long)a); |
112 | SetPagePrivate(page); | 112 | SetPagePrivate(page); |
113 | kmap(page); | 113 | kmap(page); |
114 | } | 114 | } |
@@ -136,7 +136,7 @@ static inline void remove_metapage(struct page *page, struct metapage *mp) | |||
136 | a->mp[index] = NULL; | 136 | a->mp[index] = NULL; |
137 | if (--a->mp_count == 0) { | 137 | if (--a->mp_count == 0) { |
138 | kfree(a); | 138 | kfree(a); |
139 | page->private = 0; | 139 | set_page_private(page, 0); |
140 | ClearPagePrivate(page); | 140 | ClearPagePrivate(page); |
141 | kunmap(page); | 141 | kunmap(page); |
142 | } | 142 | } |
@@ -156,13 +156,13 @@ static inline void dec_io(struct page *page, void (*handler) (struct page *)) | |||
156 | #else | 156 | #else |
157 | static inline struct metapage *page_to_mp(struct page *page, uint offset) | 157 | static inline struct metapage *page_to_mp(struct page *page, uint offset) |
158 | { | 158 | { |
159 | return PagePrivate(page) ? (struct metapage *)page->private : NULL; | 159 | return PagePrivate(page) ? (struct metapage *)page_private(page) : NULL; |
160 | } | 160 | } |
161 | 161 | ||
162 | static inline int insert_metapage(struct page *page, struct metapage *mp) | 162 | static inline int insert_metapage(struct page *page, struct metapage *mp) |
163 | { | 163 | { |
164 | if (mp) { | 164 | if (mp) { |
165 | page->private = (unsigned long)mp; | 165 | set_page_private(page, (unsigned long)mp); |
166 | SetPagePrivate(page); | 166 | SetPagePrivate(page); |
167 | kmap(page); | 167 | kmap(page); |
168 | } | 168 | } |
@@ -171,7 +171,7 @@ static inline int insert_metapage(struct page *page, struct metapage *mp) | |||
171 | 171 | ||
172 | static inline void remove_metapage(struct page *page, struct metapage *mp) | 172 | static inline void remove_metapage(struct page *page, struct metapage *mp) |
173 | { | 173 | { |
174 | page->private = 0; | 174 | set_page_private(page, 0); |
175 | ClearPagePrivate(page); | 175 | ClearPagePrivate(page); |
176 | kunmap(page); | 176 | kunmap(page); |
177 | } | 177 | } |
@@ -395,6 +395,12 @@ static int metapage_writepage(struct page *page, struct writeback_control *wbc) | |||
395 | 395 | ||
396 | if (mp->nohomeok && !test_bit(META_forcewrite, &mp->flag)) { | 396 | if (mp->nohomeok && !test_bit(META_forcewrite, &mp->flag)) { |
397 | redirty = 1; | 397 | redirty = 1; |
398 | /* | ||
399 | * Make sure this page isn't blocked indefinitely. | ||
400 | * If the journal isn't undergoing I/O, push it | ||
401 | */ | ||
402 | if (mp->log && !(mp->log->cflag & logGC_PAGEOUT)) | ||
403 | jfs_flush_journal(mp->log, 0); | ||
398 | continue; | 404 | continue; |
399 | } | 405 | } |
400 | 406 | ||
diff --git a/fs/jfs/jfs_txnmgr.c b/fs/jfs/jfs_txnmgr.c index 9b71ed2674fe..b660c93c92de 100644 --- a/fs/jfs/jfs_txnmgr.c +++ b/fs/jfs/jfs_txnmgr.c | |||
@@ -2396,7 +2396,6 @@ static void txUpdateMap(struct tblock * tblk) | |||
2396 | */ | 2396 | */ |
2397 | if (tblk->xflag & COMMIT_CREATE) { | 2397 | if (tblk->xflag & COMMIT_CREATE) { |
2398 | diUpdatePMap(ipimap, tblk->ino, FALSE, tblk); | 2398 | diUpdatePMap(ipimap, tblk->ino, FALSE, tblk); |
2399 | ipimap->i_state |= I_DIRTY; | ||
2400 | /* update persistent block allocation map | 2399 | /* update persistent block allocation map |
2401 | * for the allocation of inode extent; | 2400 | * for the allocation of inode extent; |
2402 | */ | 2401 | */ |
@@ -2407,7 +2406,6 @@ static void txUpdateMap(struct tblock * tblk) | |||
2407 | } else if (tblk->xflag & COMMIT_DELETE) { | 2406 | } else if (tblk->xflag & COMMIT_DELETE) { |
2408 | ip = tblk->u.ip; | 2407 | ip = tblk->u.ip; |
2409 | diUpdatePMap(ipimap, ip->i_ino, TRUE, tblk); | 2408 | diUpdatePMap(ipimap, ip->i_ino, TRUE, tblk); |
2410 | ipimap->i_state |= I_DIRTY; | ||
2411 | iput(ip); | 2409 | iput(ip); |
2412 | } | 2410 | } |
2413 | } | 2411 | } |
diff --git a/fs/jfs/jfs_xtree.c b/fs/jfs/jfs_xtree.c index a7fe2f2b969f..e72f4ebb6e9c 100644 --- a/fs/jfs/jfs_xtree.c +++ b/fs/jfs/jfs_xtree.c | |||
@@ -3516,16 +3516,10 @@ s64 xtTruncate(tid_t tid, struct inode *ip, s64 newsize, int flag) | |||
3516 | /* process entries backward from last index */ | 3516 | /* process entries backward from last index */ |
3517 | index = le16_to_cpu(p->header.nextindex) - 1; | 3517 | index = le16_to_cpu(p->header.nextindex) - 1; |
3518 | 3518 | ||
3519 | if (p->header.flag & BT_INTERNAL) | ||
3520 | goto getChild; | ||
3521 | |||
3522 | /* | ||
3523 | * leaf page | ||
3524 | */ | ||
3525 | 3519 | ||
3526 | /* Since this is the rightmost leaf, and we may have already freed | 3520 | /* Since this is the rightmost page at this level, and we may have |
3527 | * a page that was formerly to the right, let's make sure that the | 3521 | * already freed a page that was formerly to the right, let's make |
3528 | * next pointer is zero. | 3522 | * sure that the next pointer is zero. |
3529 | */ | 3523 | */ |
3530 | if (p->header.next) { | 3524 | if (p->header.next) { |
3531 | if (log) | 3525 | if (log) |
@@ -3539,6 +3533,12 @@ s64 xtTruncate(tid_t tid, struct inode *ip, s64 newsize, int flag) | |||
3539 | p->header.next = 0; | 3533 | p->header.next = 0; |
3540 | } | 3534 | } |
3541 | 3535 | ||
3536 | if (p->header.flag & BT_INTERNAL) | ||
3537 | goto getChild; | ||
3538 | |||
3539 | /* | ||
3540 | * leaf page | ||
3541 | */ | ||
3542 | freed = 0; | 3542 | freed = 0; |
3543 | 3543 | ||
3544 | /* does region covered by leaf page precede Teof ? */ | 3544 | /* does region covered by leaf page precede Teof ? */ |
diff --git a/fs/jfs/super.c b/fs/jfs/super.c index 71bc34b96b2b..4226af3ea91b 100644 --- a/fs/jfs/super.c +++ b/fs/jfs/super.c | |||
@@ -442,6 +442,7 @@ static int jfs_fill_super(struct super_block *sb, void *data, int silent) | |||
442 | inode->i_nlink = 1; | 442 | inode->i_nlink = 1; |
443 | inode->i_size = sb->s_bdev->bd_inode->i_size; | 443 | inode->i_size = sb->s_bdev->bd_inode->i_size; |
444 | inode->i_mapping->a_ops = &jfs_metapage_aops; | 444 | inode->i_mapping->a_ops = &jfs_metapage_aops; |
445 | insert_inode_hash(inode); | ||
445 | mapping_set_gfp_mask(inode->i_mapping, GFP_NOFS); | 446 | mapping_set_gfp_mask(inode->i_mapping, GFP_NOFS); |
446 | 447 | ||
447 | sbi->direct_inode = inode; | 448 | sbi->direct_inode = inode; |
diff --git a/fs/partitions/check.c b/fs/partitions/check.c index 1e848648a322..9c06c5434ec4 100644 --- a/fs/partitions/check.c +++ b/fs/partitions/check.c | |||
@@ -192,6 +192,7 @@ check_partition(struct gendisk *hd, struct block_device *bdev) | |||
192 | struct part_attribute { | 192 | struct part_attribute { |
193 | struct attribute attr; | 193 | struct attribute attr; |
194 | ssize_t (*show)(struct hd_struct *,char *); | 194 | ssize_t (*show)(struct hd_struct *,char *); |
195 | ssize_t (*store)(struct hd_struct *,const char *, size_t); | ||
195 | }; | 196 | }; |
196 | 197 | ||
197 | static ssize_t | 198 | static ssize_t |
@@ -201,14 +202,33 @@ part_attr_show(struct kobject * kobj, struct attribute * attr, char * page) | |||
201 | struct part_attribute * part_attr = container_of(attr,struct part_attribute,attr); | 202 | struct part_attribute * part_attr = container_of(attr,struct part_attribute,attr); |
202 | ssize_t ret = 0; | 203 | ssize_t ret = 0; |
203 | if (part_attr->show) | 204 | if (part_attr->show) |
204 | ret = part_attr->show(p,page); | 205 | ret = part_attr->show(p, page); |
206 | return ret; | ||
207 | } | ||
208 | static ssize_t | ||
209 | part_attr_store(struct kobject * kobj, struct attribute * attr, | ||
210 | const char *page, size_t count) | ||
211 | { | ||
212 | struct hd_struct * p = container_of(kobj,struct hd_struct,kobj); | ||
213 | struct part_attribute * part_attr = container_of(attr,struct part_attribute,attr); | ||
214 | ssize_t ret = 0; | ||
215 | |||
216 | if (part_attr->store) | ||
217 | ret = part_attr->store(p, page, count); | ||
205 | return ret; | 218 | return ret; |
206 | } | 219 | } |
207 | 220 | ||
208 | static struct sysfs_ops part_sysfs_ops = { | 221 | static struct sysfs_ops part_sysfs_ops = { |
209 | .show = part_attr_show, | 222 | .show = part_attr_show, |
223 | .store = part_attr_store, | ||
210 | }; | 224 | }; |
211 | 225 | ||
226 | static ssize_t part_uevent_store(struct hd_struct * p, | ||
227 | const char *page, size_t count) | ||
228 | { | ||
229 | kobject_hotplug(&p->kobj, KOBJ_ADD); | ||
230 | return count; | ||
231 | } | ||
212 | static ssize_t part_dev_read(struct hd_struct * p, char *page) | 232 | static ssize_t part_dev_read(struct hd_struct * p, char *page) |
213 | { | 233 | { |
214 | struct gendisk *disk = container_of(p->kobj.parent,struct gendisk,kobj); | 234 | struct gendisk *disk = container_of(p->kobj.parent,struct gendisk,kobj); |
@@ -229,6 +249,10 @@ static ssize_t part_stat_read(struct hd_struct * p, char *page) | |||
229 | p->reads, (unsigned long long)p->read_sectors, | 249 | p->reads, (unsigned long long)p->read_sectors, |
230 | p->writes, (unsigned long long)p->write_sectors); | 250 | p->writes, (unsigned long long)p->write_sectors); |
231 | } | 251 | } |
252 | static struct part_attribute part_attr_uevent = { | ||
253 | .attr = {.name = "uevent", .mode = S_IWUSR }, | ||
254 | .store = part_uevent_store | ||
255 | }; | ||
232 | static struct part_attribute part_attr_dev = { | 256 | static struct part_attribute part_attr_dev = { |
233 | .attr = {.name = "dev", .mode = S_IRUGO }, | 257 | .attr = {.name = "dev", .mode = S_IRUGO }, |
234 | .show = part_dev_read | 258 | .show = part_dev_read |
@@ -247,6 +271,7 @@ static struct part_attribute part_attr_stat = { | |||
247 | }; | 271 | }; |
248 | 272 | ||
249 | static struct attribute * default_attrs[] = { | 273 | static struct attribute * default_attrs[] = { |
274 | &part_attr_uevent.attr, | ||
250 | &part_attr_dev.attr, | 275 | &part_attr_dev.attr, |
251 | &part_attr_start.attr, | 276 | &part_attr_start.attr, |
252 | &part_attr_size.attr, | 277 | &part_attr_size.attr, |
diff --git a/fs/proc/array.c b/fs/proc/array.c index d84eecacbeaf..3e1239e4b303 100644 --- a/fs/proc/array.c +++ b/fs/proc/array.c | |||
@@ -438,7 +438,7 @@ static int do_task_stat(struct task_struct *task, char * buffer, int whole) | |||
438 | jiffies_to_clock_t(it_real_value), | 438 | jiffies_to_clock_t(it_real_value), |
439 | start_time, | 439 | start_time, |
440 | vsize, | 440 | vsize, |
441 | mm ? get_mm_counter(mm, rss) : 0, /* you might want to shift this left 3 */ | 441 | mm ? get_mm_rss(mm) : 0, |
442 | rsslim, | 442 | rsslim, |
443 | mm ? mm->start_code : 0, | 443 | mm ? mm->start_code : 0, |
444 | mm ? mm->end_code : 0, | 444 | mm ? mm->end_code : 0, |
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index c7ef3e48e35b..d2fa42006d8f 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c | |||
@@ -14,22 +14,41 @@ | |||
14 | char *task_mem(struct mm_struct *mm, char *buffer) | 14 | char *task_mem(struct mm_struct *mm, char *buffer) |
15 | { | 15 | { |
16 | unsigned long data, text, lib; | 16 | unsigned long data, text, lib; |
17 | unsigned long hiwater_vm, total_vm, hiwater_rss, total_rss; | ||
18 | |||
19 | /* | ||
20 | * Note: to minimize their overhead, mm maintains hiwater_vm and | ||
21 | * hiwater_rss only when about to *lower* total_vm or rss. Any | ||
22 | * collector of these hiwater stats must therefore get total_vm | ||
23 | * and rss too, which will usually be the higher. Barriers? not | ||
24 | * worth the effort, such snapshots can always be inconsistent. | ||
25 | */ | ||
26 | hiwater_vm = total_vm = mm->total_vm; | ||
27 | if (hiwater_vm < mm->hiwater_vm) | ||
28 | hiwater_vm = mm->hiwater_vm; | ||
29 | hiwater_rss = total_rss = get_mm_rss(mm); | ||
30 | if (hiwater_rss < mm->hiwater_rss) | ||
31 | hiwater_rss = mm->hiwater_rss; | ||
17 | 32 | ||
18 | data = mm->total_vm - mm->shared_vm - mm->stack_vm; | 33 | data = mm->total_vm - mm->shared_vm - mm->stack_vm; |
19 | text = (PAGE_ALIGN(mm->end_code) - (mm->start_code & PAGE_MASK)) >> 10; | 34 | text = (PAGE_ALIGN(mm->end_code) - (mm->start_code & PAGE_MASK)) >> 10; |
20 | lib = (mm->exec_vm << (PAGE_SHIFT-10)) - text; | 35 | lib = (mm->exec_vm << (PAGE_SHIFT-10)) - text; |
21 | buffer += sprintf(buffer, | 36 | buffer += sprintf(buffer, |
37 | "VmPeak:\t%8lu kB\n" | ||
22 | "VmSize:\t%8lu kB\n" | 38 | "VmSize:\t%8lu kB\n" |
23 | "VmLck:\t%8lu kB\n" | 39 | "VmLck:\t%8lu kB\n" |
40 | "VmHWM:\t%8lu kB\n" | ||
24 | "VmRSS:\t%8lu kB\n" | 41 | "VmRSS:\t%8lu kB\n" |
25 | "VmData:\t%8lu kB\n" | 42 | "VmData:\t%8lu kB\n" |
26 | "VmStk:\t%8lu kB\n" | 43 | "VmStk:\t%8lu kB\n" |
27 | "VmExe:\t%8lu kB\n" | 44 | "VmExe:\t%8lu kB\n" |
28 | "VmLib:\t%8lu kB\n" | 45 | "VmLib:\t%8lu kB\n" |
29 | "VmPTE:\t%8lu kB\n", | 46 | "VmPTE:\t%8lu kB\n", |
30 | (mm->total_vm - mm->reserved_vm) << (PAGE_SHIFT-10), | 47 | hiwater_vm << (PAGE_SHIFT-10), |
48 | (total_vm - mm->reserved_vm) << (PAGE_SHIFT-10), | ||
31 | mm->locked_vm << (PAGE_SHIFT-10), | 49 | mm->locked_vm << (PAGE_SHIFT-10), |
32 | get_mm_counter(mm, rss) << (PAGE_SHIFT-10), | 50 | hiwater_rss << (PAGE_SHIFT-10), |
51 | total_rss << (PAGE_SHIFT-10), | ||
33 | data << (PAGE_SHIFT-10), | 52 | data << (PAGE_SHIFT-10), |
34 | mm->stack_vm << (PAGE_SHIFT-10), text, lib, | 53 | mm->stack_vm << (PAGE_SHIFT-10), text, lib, |
35 | (PTRS_PER_PTE*sizeof(pte_t)*mm->nr_ptes) >> 10); | 54 | (PTRS_PER_PTE*sizeof(pte_t)*mm->nr_ptes) >> 10); |
@@ -44,13 +63,11 @@ unsigned long task_vsize(struct mm_struct *mm) | |||
44 | int task_statm(struct mm_struct *mm, int *shared, int *text, | 63 | int task_statm(struct mm_struct *mm, int *shared, int *text, |
45 | int *data, int *resident) | 64 | int *data, int *resident) |
46 | { | 65 | { |
47 | int rss = get_mm_counter(mm, rss); | 66 | *shared = get_mm_counter(mm, file_rss); |
48 | |||
49 | *shared = rss - get_mm_counter(mm, anon_rss); | ||
50 | *text = (PAGE_ALIGN(mm->end_code) - (mm->start_code & PAGE_MASK)) | 67 | *text = (PAGE_ALIGN(mm->end_code) - (mm->start_code & PAGE_MASK)) |
51 | >> PAGE_SHIFT; | 68 | >> PAGE_SHIFT; |
52 | *data = mm->total_vm - mm->shared_vm; | 69 | *data = mm->total_vm - mm->shared_vm; |
53 | *resident = rss; | 70 | *resident = *shared + get_mm_counter(mm, anon_rss); |
54 | return mm->total_vm; | 71 | return mm->total_vm; |
55 | } | 72 | } |
56 | 73 | ||
@@ -186,13 +203,14 @@ static void smaps_pte_range(struct vm_area_struct *vma, pmd_t *pmd, | |||
186 | struct mem_size_stats *mss) | 203 | struct mem_size_stats *mss) |
187 | { | 204 | { |
188 | pte_t *pte, ptent; | 205 | pte_t *pte, ptent; |
206 | spinlock_t *ptl; | ||
189 | unsigned long pfn; | 207 | unsigned long pfn; |
190 | struct page *page; | 208 | struct page *page; |
191 | 209 | ||
192 | pte = pte_offset_map(pmd, addr); | 210 | pte = pte_offset_map_lock(vma->vm_mm, pmd, addr, &ptl); |
193 | do { | 211 | do { |
194 | ptent = *pte; | 212 | ptent = *pte; |
195 | if (pte_none(ptent) || !pte_present(ptent)) | 213 | if (!pte_present(ptent)) |
196 | continue; | 214 | continue; |
197 | 215 | ||
198 | mss->resident += PAGE_SIZE; | 216 | mss->resident += PAGE_SIZE; |
@@ -213,8 +231,8 @@ static void smaps_pte_range(struct vm_area_struct *vma, pmd_t *pmd, | |||
213 | mss->private_clean += PAGE_SIZE; | 231 | mss->private_clean += PAGE_SIZE; |
214 | } | 232 | } |
215 | } while (pte++, addr += PAGE_SIZE, addr != end); | 233 | } while (pte++, addr += PAGE_SIZE, addr != end); |
216 | pte_unmap(pte - 1); | 234 | pte_unmap_unlock(pte - 1, ptl); |
217 | cond_resched_lock(&vma->vm_mm->page_table_lock); | 235 | cond_resched(); |
218 | } | 236 | } |
219 | 237 | ||
220 | static inline void smaps_pmd_range(struct vm_area_struct *vma, pud_t *pud, | 238 | static inline void smaps_pmd_range(struct vm_area_struct *vma, pud_t *pud, |
@@ -268,17 +286,11 @@ static inline void smaps_pgd_range(struct vm_area_struct *vma, | |||
268 | static int show_smap(struct seq_file *m, void *v) | 286 | static int show_smap(struct seq_file *m, void *v) |
269 | { | 287 | { |
270 | struct vm_area_struct *vma = v; | 288 | struct vm_area_struct *vma = v; |
271 | struct mm_struct *mm = vma->vm_mm; | ||
272 | struct mem_size_stats mss; | 289 | struct mem_size_stats mss; |
273 | 290 | ||
274 | memset(&mss, 0, sizeof mss); | 291 | memset(&mss, 0, sizeof mss); |
275 | 292 | if (vma->vm_mm) | |
276 | if (mm) { | ||
277 | spin_lock(&mm->page_table_lock); | ||
278 | smaps_pgd_range(vma, vma->vm_start, vma->vm_end, &mss); | 293 | smaps_pgd_range(vma, vma->vm_start, vma->vm_end, &mss); |
279 | spin_unlock(&mm->page_table_lock); | ||
280 | } | ||
281 | |||
282 | return show_map_internal(m, v, &mss); | 294 | return show_map_internal(m, v, &mss); |
283 | } | 295 | } |
284 | 296 | ||
@@ -407,7 +419,6 @@ static struct numa_maps *get_numa_maps(const struct vm_area_struct *vma) | |||
407 | for_each_node(i) | 419 | for_each_node(i) |
408 | md->node[i] =0; | 420 | md->node[i] =0; |
409 | 421 | ||
410 | spin_lock(&mm->page_table_lock); | ||
411 | for (vaddr = vma->vm_start; vaddr < vma->vm_end; vaddr += PAGE_SIZE) { | 422 | for (vaddr = vma->vm_start; vaddr < vma->vm_end; vaddr += PAGE_SIZE) { |
412 | page = follow_page(mm, vaddr, 0); | 423 | page = follow_page(mm, vaddr, 0); |
413 | if (page) { | 424 | if (page) { |
@@ -422,8 +433,8 @@ static struct numa_maps *get_numa_maps(const struct vm_area_struct *vma) | |||
422 | md->anon++; | 433 | md->anon++; |
423 | md->node[page_to_nid(page)]++; | 434 | md->node[page_to_nid(page)]++; |
424 | } | 435 | } |
436 | cond_resched(); | ||
425 | } | 437 | } |
426 | spin_unlock(&mm->page_table_lock); | ||
427 | return md; | 438 | return md; |
428 | } | 439 | } |
429 | 440 | ||
@@ -469,7 +480,7 @@ static int show_numa_map(struct seq_file *m, void *v) | |||
469 | seq_printf(m, " interleave={"); | 480 | seq_printf(m, " interleave={"); |
470 | first = 1; | 481 | first = 1; |
471 | for_each_node(n) { | 482 | for_each_node(n) { |
472 | if (test_bit(n, pol->v.nodes)) { | 483 | if (node_isset(n, pol->v.nodes)) { |
473 | if (!first) | 484 | if (!first) |
474 | seq_putc(m,','); | 485 | seq_putc(m,','); |
475 | else | 486 | else |
diff --git a/fs/xfs/linux-2.6/xfs_buf.c b/fs/xfs/linux-2.6/xfs_buf.c index ba4767c04adf..4cd46abe8434 100644 --- a/fs/xfs/linux-2.6/xfs_buf.c +++ b/fs/xfs/linux-2.6/xfs_buf.c | |||
@@ -181,8 +181,9 @@ set_page_region( | |||
181 | size_t offset, | 181 | size_t offset, |
182 | size_t length) | 182 | size_t length) |
183 | { | 183 | { |
184 | page->private |= page_region_mask(offset, length); | 184 | set_page_private(page, |
185 | if (page->private == ~0UL) | 185 | page_private(page) | page_region_mask(offset, length)); |
186 | if (page_private(page) == ~0UL) | ||
186 | SetPageUptodate(page); | 187 | SetPageUptodate(page); |
187 | } | 188 | } |
188 | 189 | ||
@@ -194,7 +195,7 @@ test_page_region( | |||
194 | { | 195 | { |
195 | unsigned long mask = page_region_mask(offset, length); | 196 | unsigned long mask = page_region_mask(offset, length); |
196 | 197 | ||
197 | return (mask && (page->private & mask) == mask); | 198 | return (mask && (page_private(page) & mask) == mask); |
198 | } | 199 | } |
199 | 200 | ||
200 | /* | 201 | /* |