Skip to content

Commit bff9018

Browse files
Christoph Hellwigsmfrench
authored andcommitted
cifs: stop using generic_writepages
generic_writepages is just a wrapper that calls ->writepages on a range, and thus in the way of eventually removing ->writepage. Switch cifs to just open code it in preparation of removing ->writepage. [note: I suspect just integrating the small wsize case with the rest of the writeback code might be a better idea here, but that needs someone more familiar with the code] Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: Paulo Alcantara (SUSE) <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent 9381666 commit bff9018

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

fs/cifs/file.c

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2646,6 +2646,21 @@ wdata_send_pages(struct cifs_writedata *wdata, unsigned int nr_pages,
26462646
return rc;
26472647
}
26482648

2649+
static int
2650+
cifs_writepage_locked(struct page *page, struct writeback_control *wbc);
2651+
2652+
static int cifs_write_one_page(struct page *page, struct writeback_control *wbc,
2653+
void *data)
2654+
{
2655+
struct address_space *mapping = data;
2656+
int ret;
2657+
2658+
ret = cifs_writepage_locked(page, wbc);
2659+
unlock_page(page);
2660+
mapping_set_error(mapping, ret);
2661+
return ret;
2662+
}
2663+
26492664
static int cifs_writepages(struct address_space *mapping,
26502665
struct writeback_control *wbc)
26512666
{
@@ -2662,10 +2677,11 @@ static int cifs_writepages(struct address_space *mapping,
26622677

26632678
/*
26642679
* If wsize is smaller than the page cache size, default to writing
2665-
* one page at a time via cifs_writepage
2680+
* one page at a time.
26662681
*/
26672682
if (cifs_sb->ctx->wsize < PAGE_SIZE)
2668-
return generic_writepages(mapping, wbc);
2683+
return write_cache_pages(mapping, wbc, cifs_write_one_page,
2684+
mapping);
26692685

26702686
xid = get_xid();
26712687
if (wbc->range_cyclic) {

0 commit comments

Comments
 (0)