Commit 258f0603 authored by Pavel Shilovsky's avatar Pavel Shilovsky Committed by Steve French

CIFS: Move unlocking pages from wdata_send_pages()

Currently wdata_send_pages() unlocks pages after sending.
This complicates further refactoring and doesn't align
with the function name. Move unlocking to writepages.
Signed-off-by: default avatarPavel Shilovsky <pshilov@microsoft.com>
Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
parent c7d38dbe
...@@ -2080,8 +2080,7 @@ wdata_send_pages(struct TCP_Server_Info *server, struct cifs_writedata *wdata, ...@@ -2080,8 +2080,7 @@ wdata_send_pages(struct TCP_Server_Info *server, struct cifs_writedata *wdata,
unsigned int nr_pages, struct address_space *mapping, unsigned int nr_pages, struct address_space *mapping,
struct writeback_control *wbc) struct writeback_control *wbc)
{ {
int rc = 0; int rc;
unsigned int i;
wdata->sync_mode = wbc->sync_mode; wdata->sync_mode = wbc->sync_mode;
wdata->nr_pages = nr_pages; wdata->nr_pages = nr_pages;
...@@ -2094,7 +2093,7 @@ wdata_send_pages(struct TCP_Server_Info *server, struct cifs_writedata *wdata, ...@@ -2094,7 +2093,7 @@ wdata_send_pages(struct TCP_Server_Info *server, struct cifs_writedata *wdata,
rc = adjust_credits(server, &wdata->credits, wdata->bytes); rc = adjust_credits(server, &wdata->credits, wdata->bytes);
if (rc) if (rc)
goto send_pages_out; return rc;
if (!wdata->cfile) { if (!wdata->cfile) {
cifs_dbg(VFS, "No writable handle in writepages\n"); cifs_dbg(VFS, "No writable handle in writepages\n");
...@@ -2108,10 +2107,6 @@ wdata_send_pages(struct TCP_Server_Info *server, struct cifs_writedata *wdata, ...@@ -2108,10 +2107,6 @@ wdata_send_pages(struct TCP_Server_Info *server, struct cifs_writedata *wdata,
cifs_writedata_release); cifs_writedata_release);
} }
send_pages_out:
for (i = 0; i < nr_pages; ++i)
unlock_page(wdata->pages[i]);
return rc; return rc;
} }
...@@ -2200,6 +2195,9 @@ static int cifs_writepages(struct address_space *mapping, ...@@ -2200,6 +2195,9 @@ static int cifs_writepages(struct address_space *mapping,
rc = wdata_send_pages(server, wdata, nr_pages, mapping, wbc); rc = wdata_send_pages(server, wdata, nr_pages, mapping, wbc);
for (i = 0; i < nr_pages; ++i)
unlock_page(wdata->pages[i]);
/* send failure -- clean up the mess */ /* send failure -- clean up the mess */
if (rc != 0) { if (rc != 0) {
add_credits_and_wake_if(server, &wdata->credits, 0); add_credits_and_wake_if(server, &wdata->credits, 0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment