Re: [PATCH v3 6/6] mm,thp: handle writes to file with THP in pagecache

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2019-06-18 at 23:24 -0700, Song Liu wrote:

> index 8563339041f6..bab8d9eef46c 100644
> --- a/mm/truncate.c
> +++ b/mm/truncate.c
> @@ -790,7 +790,11 @@ EXPORT_SYMBOL_GPL(invalidate_inode_pages2);
>  void truncate_pagecache(struct inode *inode, loff_t newsize)
>  {
>  	struct address_space *mapping = inode->i_mapping;
> -	loff_t holebegin = round_up(newsize, PAGE_SIZE);
> +	loff_t holebegin;
> +
> +	/* if non-shmem file has thp, truncate the whole file */
> +	if (filemap_nr_thps(mapping))
> +		newsize = 0;
>  

I don't get it. Sometimes truncate is used to
increase the size of a file, or to change it
to a non-zero size.

Won't forcing the newsize to zero break applications,
when the file is truncated to a different size than
they expect?





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux