diff options
Diffstat (limited to 'mm')
-rw-r--r-- | mm/bootmem.c | 14 | ||||
-rw-r--r-- | mm/filemap.c | 11 | ||||
-rw-r--r-- | mm/memory.c | 2 | ||||
-rw-r--r-- | mm/page_io.c | 2 |
4 files changed, 21 insertions, 8 deletions
diff --git a/mm/bootmem.c b/mm/bootmem.c index f82f7aebbee3..c1330cc19783 100644 --- a/mm/bootmem.c +++ b/mm/bootmem.c | |||
@@ -33,6 +33,14 @@ EXPORT_SYMBOL(max_pfn); /* This is exported so | |||
33 | * dma_get_required_mask(), which uses | 33 | * dma_get_required_mask(), which uses |
34 | * it, can be an inline function */ | 34 | * it, can be an inline function */ |
35 | 35 | ||
36 | #ifdef CONFIG_CRASH_DUMP | ||
37 | /* | ||
38 | * If we have booted due to a crash, max_pfn will be a very low value. We need | ||
39 | * to know the amount of memory that the previous kernel used. | ||
40 | */ | ||
41 | unsigned long saved_max_pfn; | ||
42 | #endif | ||
43 | |||
36 | /* return the number of _pages_ that will be allocated for the boot bitmap */ | 44 | /* return the number of _pages_ that will be allocated for the boot bitmap */ |
37 | unsigned long __init bootmem_bootmap_pages (unsigned long pages) | 45 | unsigned long __init bootmem_bootmap_pages (unsigned long pages) |
38 | { | 46 | { |
@@ -57,7 +65,7 @@ static unsigned long __init init_bootmem_core (pg_data_t *pgdat, | |||
57 | pgdat->pgdat_next = pgdat_list; | 65 | pgdat->pgdat_next = pgdat_list; |
58 | pgdat_list = pgdat; | 66 | pgdat_list = pgdat; |
59 | 67 | ||
60 | mapsize = (mapsize + (sizeof(long) - 1UL)) & ~(sizeof(long) - 1UL); | 68 | mapsize = ALIGN(mapsize, sizeof(long)); |
61 | bdata->node_bootmem_map = phys_to_virt(mapstart << PAGE_SHIFT); | 69 | bdata->node_bootmem_map = phys_to_virt(mapstart << PAGE_SHIFT); |
62 | bdata->node_boot_start = (start << PAGE_SHIFT); | 70 | bdata->node_boot_start = (start << PAGE_SHIFT); |
63 | bdata->node_low_pfn = end; | 71 | bdata->node_low_pfn = end; |
@@ -178,7 +186,7 @@ __alloc_bootmem_core(struct bootmem_data *bdata, unsigned long size, | |||
178 | } else | 186 | } else |
179 | preferred = 0; | 187 | preferred = 0; |
180 | 188 | ||
181 | preferred = ((preferred + align - 1) & ~(align - 1)) >> PAGE_SHIFT; | 189 | preferred = ALIGN(preferred, align) >> PAGE_SHIFT; |
182 | preferred += offset; | 190 | preferred += offset; |
183 | areasize = (size+PAGE_SIZE-1)/PAGE_SIZE; | 191 | areasize = (size+PAGE_SIZE-1)/PAGE_SIZE; |
184 | incr = align >> PAGE_SHIFT ? : 1; | 192 | incr = align >> PAGE_SHIFT ? : 1; |
@@ -219,7 +227,7 @@ found: | |||
219 | */ | 227 | */ |
220 | if (align < PAGE_SIZE && | 228 | if (align < PAGE_SIZE && |
221 | bdata->last_offset && bdata->last_pos+1 == start) { | 229 | bdata->last_offset && bdata->last_pos+1 == start) { |
222 | offset = (bdata->last_offset+align-1) & ~(align-1); | 230 | offset = ALIGN(bdata->last_offset, align); |
223 | BUG_ON(offset > PAGE_SIZE); | 231 | BUG_ON(offset > PAGE_SIZE); |
224 | remaining_size = PAGE_SIZE-offset; | 232 | remaining_size = PAGE_SIZE-offset; |
225 | if (size < remaining_size) { | 233 | if (size < remaining_size) { |
diff --git a/mm/filemap.c b/mm/filemap.c index 7332194d7afd..c11418dd94e8 100644 --- a/mm/filemap.c +++ b/mm/filemap.c | |||
@@ -1851,8 +1851,11 @@ generic_file_direct_write(struct kiocb *iocb, const struct iovec *iov, | |||
1851 | * i_sem is held, which protects generic_osync_inode() from | 1851 | * i_sem is held, which protects generic_osync_inode() from |
1852 | * livelocking. | 1852 | * livelocking. |
1853 | */ | 1853 | */ |
1854 | if (written >= 0 && file->f_flags & O_SYNC) | 1854 | if (written >= 0 && ((file->f_flags & O_SYNC) || IS_SYNC(inode))) { |
1855 | generic_osync_inode(inode, mapping, OSYNC_METADATA); | 1855 | int err = generic_osync_inode(inode, mapping, OSYNC_METADATA); |
1856 | if (err < 0) | ||
1857 | written = err; | ||
1858 | } | ||
1856 | if (written == count && !is_sync_kiocb(iocb)) | 1859 | if (written == count && !is_sync_kiocb(iocb)) |
1857 | written = -EIOCBQUEUED; | 1860 | written = -EIOCBQUEUED; |
1858 | return written; | 1861 | return written; |
@@ -1951,7 +1954,9 @@ generic_file_buffered_write(struct kiocb *iocb, const struct iovec *iov, | |||
1951 | if (unlikely(nr_segs > 1)) { | 1954 | if (unlikely(nr_segs > 1)) { |
1952 | filemap_set_next_iovec(&cur_iov, | 1955 | filemap_set_next_iovec(&cur_iov, |
1953 | &iov_base, status); | 1956 | &iov_base, status); |
1954 | buf = cur_iov->iov_base + iov_base; | 1957 | if (count) |
1958 | buf = cur_iov->iov_base + | ||
1959 | iov_base; | ||
1955 | } else { | 1960 | } else { |
1956 | iov_base += status; | 1961 | iov_base += status; |
1957 | } | 1962 | } |
diff --git a/mm/memory.c b/mm/memory.c index c256175742ac..beabdefa6254 100644 --- a/mm/memory.c +++ b/mm/memory.c | |||
@@ -1139,7 +1139,7 @@ int remap_pfn_range(struct vm_area_struct *vma, unsigned long addr, | |||
1139 | { | 1139 | { |
1140 | pgd_t *pgd; | 1140 | pgd_t *pgd; |
1141 | unsigned long next; | 1141 | unsigned long next; |
1142 | unsigned long end = addr + size; | 1142 | unsigned long end = addr + PAGE_ALIGN(size); |
1143 | struct mm_struct *mm = vma->vm_mm; | 1143 | struct mm_struct *mm = vma->vm_mm; |
1144 | int err; | 1144 | int err; |
1145 | 1145 | ||
diff --git a/mm/page_io.c b/mm/page_io.c index 667c76df1ec2..2e605a19ce57 100644 --- a/mm/page_io.c +++ b/mm/page_io.c | |||
@@ -127,7 +127,7 @@ out: | |||
127 | return ret; | 127 | return ret; |
128 | } | 128 | } |
129 | 129 | ||
130 | #if defined(CONFIG_SOFTWARE_SUSPEND) || defined(CONFIG_PM_DISK) | 130 | #ifdef CONFIG_SOFTWARE_SUSPEND |
131 | /* | 131 | /* |
132 | * A scruffy utility function to read or write an arbitrary swap page | 132 | * A scruffy utility function to read or write an arbitrary swap page |
133 | * and wait on the I/O. The caller must have a ref on the page. | 133 | * and wait on the I/O. The caller must have a ref on the page. |