hostfs: Replace kmap() with kmap_local_page()
[linux-2.6-block.git] / fs / hostfs / hostfs_kern.c
index 277468783feeecbe8199da3d4ab7df924ff3e2e6..609f692246430187b81bf33e47635da3a538a1f1 100644 (file)
@@ -412,7 +412,7 @@ static int hostfs_writepage(struct page *page, struct writeback_control *wbc)
        if (page->index >= end_index)
                count = inode->i_size & (PAGE_SIZE-1);
 
-       buffer = kmap(page);
+       buffer = kmap_local_page(page);
 
        err = write_file(HOSTFS_I(inode)->fd, &base, buffer, count);
        if (err != count) {
@@ -428,9 +428,9 @@ static int hostfs_writepage(struct page *page, struct writeback_control *wbc)
        err = 0;
 
  out:
-       kunmap(page);
-
+       kunmap_local(buffer);
        unlock_page(page);
+
        return err;
 }
 
@@ -441,7 +441,7 @@ static int hostfs_read_folio(struct file *file, struct folio *folio)
        loff_t start = page_offset(page);
        int bytes_read, ret = 0;
 
-       buffer = kmap(page);
+       buffer = kmap_local_page(page);
        bytes_read = read_file(FILE_HOSTFS_I(file)->fd, &start, buffer,
                        PAGE_SIZE);
        if (bytes_read < 0) {
@@ -458,8 +458,9 @@ static int hostfs_read_folio(struct file *file, struct folio *folio)
 
  out:
        flush_dcache_page(page);
-       kunmap(page);
+       kunmap_local(buffer);
        unlock_page(page);
+
        return ret;
 }
 
@@ -484,9 +485,9 @@ static int hostfs_write_end(struct file *file, struct address_space *mapping,
        unsigned from = pos & (PAGE_SIZE - 1);
        int err;
 
-       buffer = kmap(page);
+       buffer = kmap_local_page(page);
        err = write_file(FILE_HOSTFS_I(file)->fd, &pos, buffer + from, copied);
-       kunmap(page);
+       kunmap_local(buffer);
 
        if (!PageUptodate(page) && err == PAGE_SIZE)
                SetPageUptodate(page);