Re: [PATCH RESEND v1 05/16] vfs: add hooks to enable hot tracking

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

 



On Thu, Dec 20, 2012 at 10:43:24PM +0800, zwu.kernel@xxxxxxxxx wrote:
> --- a/fs/direct-io.c
> +++ b/fs/direct-io.c
> @@ -37,6 +37,7 @@
>  #include <linux/uio.h>
>  #include <linux/atomic.h>
>  #include <linux/prefetch.h>
> +#include "hot_tracking.h"
>  
>  /*
>   * How many user pages to map in one call to get_user_pages().  This determines
> @@ -1299,6 +1300,11 @@ __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode,
>  	prefetch(bdev->bd_queue);
>  	prefetch((char *)bdev->bd_queue + SMP_CACHE_BYTES);
>  
> +	/* Hot data tracking */
> +	hot_update_freqs(inode, offset,
> +			iov_length(iov, nr_segs),
> +			rw & WRITE);

hot_update_freqs takes an 'int rw' directly, so you should pass plain
'rw' here and do the 'rw & WRITE' check in hot_freq_data_update itself.

> +
>  	return do_blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset,
>  				     nr_segs, get_block, end_io,
>  				     submit_io, flags);
> --- a/mm/page-writeback.c
> +++ b/mm/page-writeback.c
> @@ -35,6 +35,7 @@
>  #include <linux/buffer_head.h> /* __set_page_dirty_buffers */
>  #include <linux/pagevec.h>
>  #include <linux/timer.h>
> +#include <linux/hot_tracking.h>
>  #include <trace/events/writeback.h>
>  
>  /*
> @@ -1902,13 +1903,24 @@ EXPORT_SYMBOL(generic_writepages);
>  int do_writepages(struct address_space *mapping, struct writeback_control *wbc)
>  {
>  	int ret;
> +	loff_t start = 0;
> +	size_t count = 0;
>  
>  	if (wbc->nr_to_write <= 0)
>  		return 0;
> +
> +	start = mapping->writeback_index << PAGE_CACHE_SHIFT;
> +	count = wbc->nr_to_write;
> +
>  	if (mapping->a_ops->writepages)
>  		ret = mapping->a_ops->writepages(mapping, wbc);
>  	else
>  		ret = generic_writepages(mapping, wbc);
> +
> +	/* Hot data tracking */
> +	hot_update_freqs(mapping->host, start,
> +			(count - wbc->nr_to_write) * PAGE_CACHE_SIZE, 1);

I think the frequencies should not be updated in case of error returned
from writepages.

> +
>  	return ret;
>  }
>  
> --- a/mm/readahead.c
> +++ b/mm/readahead.c
> @@ -138,6 +139,12 @@ static int read_pages(struct address_space *mapping, struct file *filp,
>  out:
>  	blk_finish_plug(&plug);
>  
> +	/* Hot data tracking */
> +	hot_update_freqs(mapping->host,
> +		(loff_t)(list_entry(pages->prev, struct page, lru)->index)
> +			<< PAGE_CACHE_SHIFT,
> +		(size_t)nr_pages * PAGE_CACHE_SIZE, 0);

same comment here

> +
>  	return ret;
>  }


david
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux