blocklayout.c (6f018efac14eb267d3ba0aa4294594b556147dba) | blocklayout.c (6296556f0b31eaff29f2a3aee2c17b7eae895b98) |
---|---|
1/* 2 * linux/fs/nfs/blocklayout/blocklayout.c 3 * 4 * Module for the NFSv4.1 pNFS block layout driver. 5 * 6 * Copyright (c) 2006 The Regents of the University of Michigan. 7 * All rights reserved. 8 * --- 23 unchanged lines hidden (view full) --- 32 33#include <linux/module.h> 34#include <linux/init.h> 35#include <linux/mount.h> 36#include <linux/namei.h> 37#include <linux/bio.h> /* struct bio */ 38#include <linux/buffer_head.h> /* various write calls */ 39#include <linux/prefetch.h> | 1/* 2 * linux/fs/nfs/blocklayout/blocklayout.c 3 * 4 * Module for the NFSv4.1 pNFS block layout driver. 5 * 6 * Copyright (c) 2006 The Regents of the University of Michigan. 7 * All rights reserved. 8 * --- 23 unchanged lines hidden (view full) --- 32 33#include <linux/module.h> 34#include <linux/init.h> 35#include <linux/mount.h> 36#include <linux/namei.h> 37#include <linux/bio.h> /* struct bio */ 38#include <linux/buffer_head.h> /* various write calls */ 39#include <linux/prefetch.h> |
40#include <linux/pagevec.h> |
|
40 41#include "../pnfs.h" 42#include "../internal.h" 43#include "blocklayout.h" 44 45#define NFSDBG_FACILITY NFSDBG_PNFS_LD 46 47MODULE_LICENSE("GPL"); --- 1151 unchanged lines hidden (view full) --- 1199{ 1200 if (pgio->pg_dreq != NULL && 1201 !is_aligned_req(req, SECTOR_SIZE)) 1202 return false; 1203 1204 return pnfs_generic_pg_test(pgio, prev, req); 1205} 1206 | 41 42#include "../pnfs.h" 43#include "../internal.h" 44#include "blocklayout.h" 45 46#define NFSDBG_FACILITY NFSDBG_PNFS_LD 47 48MODULE_LICENSE("GPL"); --- 1151 unchanged lines hidden (view full) --- 1200{ 1201 if (pgio->pg_dreq != NULL && 1202 !is_aligned_req(req, SECTOR_SIZE)) 1203 return false; 1204 1205 return pnfs_generic_pg_test(pgio, prev, req); 1206} 1207 |
1208/* 1209 * Return the number of contiguous bytes for a given inode 1210 * starting at page frame idx. 1211 */ 1212static u64 pnfs_num_cont_bytes(struct inode *inode, pgoff_t idx) 1213{ 1214 struct address_space *mapping = inode->i_mapping; 1215 pgoff_t end; 1216 1217 /* Optimize common case that writes from 0 to end of file */ 1218 end = DIV_ROUND_UP(i_size_read(inode), PAGE_CACHE_SIZE); 1219 if (end != NFS_I(inode)->npages) { 1220 rcu_read_lock(); 1221 end = radix_tree_next_hole(&mapping->page_tree, idx + 1, ULONG_MAX); 1222 rcu_read_unlock(); 1223 } 1224 1225 if (!end) 1226 return i_size_read(inode) - (idx << PAGE_CACHE_SHIFT); 1227 else 1228 return (end - idx) << PAGE_CACHE_SHIFT; 1229} 1230 |
|
1207static void 1208bl_pg_init_write(struct nfs_pageio_descriptor *pgio, struct nfs_page *req) 1209{ 1210 if (pgio->pg_dreq != NULL && | 1231static void 1232bl_pg_init_write(struct nfs_pageio_descriptor *pgio, struct nfs_page *req) 1233{ 1234 if (pgio->pg_dreq != NULL && |
1211 !is_aligned_req(req, PAGE_CACHE_SIZE)) | 1235 !is_aligned_req(req, PAGE_CACHE_SIZE)) { |
1212 nfs_pageio_reset_write_mds(pgio); | 1236 nfs_pageio_reset_write_mds(pgio); |
1213 else 1214 pnfs_generic_pg_init_write(pgio, req); | 1237 } else { 1238 u64 wb_size; 1239 if (pgio->pg_dreq == NULL) 1240 wb_size = pnfs_num_cont_bytes(pgio->pg_inode, 1241 req->wb_index); 1242 else 1243 wb_size = nfs_dreq_bytes_left(pgio->pg_dreq); 1244 1245 pnfs_generic_pg_init_write(pgio, req, wb_size); 1246 } |
1215} 1216 1217static bool 1218bl_pg_test_write(struct nfs_pageio_descriptor *pgio, struct nfs_page *prev, 1219 struct nfs_page *req) 1220{ 1221 if (pgio->pg_dreq != NULL && 1222 !is_aligned_req(req, PAGE_CACHE_SIZE)) --- 200 unchanged lines hidden --- | 1247} 1248 1249static bool 1250bl_pg_test_write(struct nfs_pageio_descriptor *pgio, struct nfs_page *prev, 1251 struct nfs_page *req) 1252{ 1253 if (pgio->pg_dreq != NULL && 1254 !is_aligned_req(req, PAGE_CACHE_SIZE)) --- 200 unchanged lines hidden --- |