Skip to content

Commit 315e995

Browse files
Nick PigginSteve French
authored andcommitted
[CIFS] use add_to_page_cache_lru
add_to_page_cache_lru is exported, so it should be used. Benefits over using a private pagevec: neater code, 128 bytes fewer stack used, percpu lru ordering is preserved, and finally don't need to flush pagevec before returning so batching may be shared with other LRU insertions. Signed-off-by: Nick Piggin <npiggin@suse.de> Reviewed-by: Dave Kleikamp <shaggy@linux.vnet.ibm.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
1 parent 05ce7bf commit 315e995

1 file changed

Lines changed: 3 additions & 10 deletions

File tree

‎fs/cifs/file.c‎

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1931,8 +1931,7 @@ int cifs_file_mmap(struct file *file, struct vm_area_struct *vma)
19311931

19321932

19331933
static void cifs_copy_cache_pages(struct address_space *mapping,
1934-
struct list_head *pages, int bytes_read, char *data,
1935-
struct pagevec *plru_pvec)
1934+
struct list_head *pages, int bytes_read, char *data)
19361935
{
19371936
struct page *page;
19381937
char *target;
@@ -1944,7 +1943,7 @@ static void cifs_copy_cache_pages(struct address_space *mapping,
19441943
page = list_entry(pages->prev, struct page, lru);
19451944
list_del(&page->lru);
19461945

1947-
if (add_to_page_cache(page, mapping, page->index,
1946+
if (add_to_page_cache_lru(page, mapping, page->index,
19481947
GFP_KERNEL)) {
19491948
page_cache_release(page);
19501949
cFYI(1, ("Add page cache failed"));
@@ -1970,8 +1969,6 @@ static void cifs_copy_cache_pages(struct address_space *mapping,
19701969
flush_dcache_page(page);
19711970
SetPageUptodate(page);
19721971
unlock_page(page);
1973-
if (!pagevec_add(plru_pvec, page))
1974-
__pagevec_lru_add_file(plru_pvec);
19751972
data += PAGE_CACHE_SIZE;
19761973
}
19771974
return;
@@ -1990,7 +1987,6 @@ static int cifs_readpages(struct file *file, struct address_space *mapping,
19901987
unsigned int read_size, i;
19911988
char *smb_read_data = NULL;
19921989
struct smb_com_read_rsp *pSMBr;
1993-
struct pagevec lru_pvec;
19941990
struct cifsFileInfo *open_file;
19951991
int buf_type = CIFS_NO_BUFFER;
19961992

@@ -2004,7 +2000,6 @@ static int cifs_readpages(struct file *file, struct address_space *mapping,
20042000
cifs_sb = CIFS_SB(file->f_path.dentry->d_sb);
20052001
pTcon = cifs_sb->tcon;
20062002

2007-
pagevec_init(&lru_pvec, 0);
20082003
cFYI(DBG2, ("rpages: num pages %d", num_pages));
20092004
for (i = 0; i < num_pages; ) {
20102005
unsigned contig_pages;
@@ -2073,7 +2068,7 @@ static int cifs_readpages(struct file *file, struct address_space *mapping,
20732068
pSMBr = (struct smb_com_read_rsp *)smb_read_data;
20742069
cifs_copy_cache_pages(mapping, page_list, bytes_read,
20752070
smb_read_data + 4 /* RFC1001 hdr */ +
2076-
le16_to_cpu(pSMBr->DataOffset), &lru_pvec);
2071+
le16_to_cpu(pSMBr->DataOffset));
20772072

20782073
i += bytes_read >> PAGE_CACHE_SHIFT;
20792074
cifs_stats_bytes_read(pTcon, bytes_read);
@@ -2106,8 +2101,6 @@ static int cifs_readpages(struct file *file, struct address_space *mapping,
21062101
bytes_read = 0;
21072102
}
21082103

2109-
pagevec_lru_add_file(&lru_pvec);
2110-
21112104
/* need to free smb_read_data buf before exit */
21122105
if (smb_read_data) {
21132106
if (buf_type == CIFS_SMALL_BUFFER)

0 commit comments

Comments
 (0)