ComplexFileLayout Original Patch
From Linux NFS
(Difference between revisions)
m |
|
(One intermediate revision not shown) |
Latest revision as of 18:00, 15 June 2007
Index: fs/nfs/nfs4filelayout.c =================================================================== RCS file: /cvs/nfsv4/cvs/pnfs/fs/nfs/nfs4filelayout.c,v retrieving revision 1.22 diff -r1.22 nfs4filelayout.c 154a155,196 > > > > /* This function is used by the layout driver to caclulate the > > * offset of the file on the dserver based on whether the > > * layout type is STRIPE_DENSE or STRIPE_SPARSE > > */ > > loff_t > > filelayout_get_dserver_offset(loff_t offset, struct nfs4_filelayout * layout) > > { > > BUG_ON(layout == NULL); > > > > switch (layout->stripe_type) { > > case STRIPE_SPARSE: > > return offset; > > > > case STRIPE_DENSE: > > { > > u32 stripe_size; > > u32 stripe_unit; > > loff_t off; > > loff_t tmp; > > u32 stripe_unit_idx; > > > > stripe_size = layout->stripe_unit * layout->num_devs; > > /* XXX I do this because do_div seems to take a 32 bit dividend */ > > stripe_unit = layout->stripe_unit; > > tmp = off = offset; > > > > do_div(off, stripe_size); > > stripe_unit_idx = do_div(tmp, stripe_unit); > > > > return off * stripe_unit stripe_unit_idx; > > } > > > > default: > > BUG(); > > } > > > > /* We should never get here... just to stop the gcc warning */ > > return 0; > > } > > > > 196a239,245 > > > > /* Now get the file offset on the dserver > > * Set the read offset to this offset, and > > * save the original offset in orig_offset > > */ > > data->args.offset = filelayout_get_dserver_offset(offset, nfslay); > > data->orig_offset = offset; 202a252 > > 206a257,259 > > > > /* In the case of synchronous reads, we reset the offset here */ > > data->args.offset = data->orig_offset; 209a263,265 > > /* In the case of aync reads, the offset will be reset in the > > * call_ops->rpc_call_done() routine > > */ 253a310,316 > > /* Now get the file offset on the dserver > > * Set the write offset to this offset, and > > * save the original offset in orig_offset > > */ > > data->args.offset = filelayout_get_dserver_offset(offset, nfslay); > > data->orig_offset = offset; > > 262a326,328 > > > > /* In the case of synchronous writes, we reset the offset here */ > > data->args.offset = data->orig_offset; 265a332,334 > > /* In the case of aync writes, the offset will be reset in the > > * call_ops->rpc_call_done() routine > > */ Index: fs/nfs/nfs4filelayout.h =================================================================== RCS file: /cvs/nfsv4/cvs/pnfs/fs/nfs/nfs4filelayout.h,v retrieving revision 1.3 diff -r1.3 nfs4filelayout.h 21a22,26 > > enum stripetype4 { > > STRIPE_SPARSE = 1, > > STRIPE_DENSE = 2 > > }; > > Index: fs/nfs/read.c =================================================================== RCS file: /cvs/nfsv4/cvs/pnfs/fs/nfs/read.c,v retrieving revision 1.13 diff -r1.13 read.c 526a527,534 > > #ifdef CONFIG_NFS_V4 > > /* Restore the data->args->offset pointer to the actual offset > > * if it was changed > > */ > > if (data->orig_offset) > > data->args.offset = data->orig_offset; > > #endif > > 569a578,585 > > > > #ifdef CONFIG_NFS_V4 > > /* Restore the data->args->offset pointer to the actual offset > > * if it was changed > > */ > > if (data->orig_offset) > > data->args.offset = data->orig_offset; > > #endif Index: fs/nfs/write.c =================================================================== RCS file: /cvs/nfsv4/cvs/pnfs/fs/nfs/write.c,v retrieving revision 1.24 diff -r1.24 write.c 1222a1223,1230 > > #ifdef CONFIG_NFS_V4 > > /* Restore the data->args->offset pointer to the actual offset > > * if it was changed > > */ > > if (data->orig_offset) > > data->args.offset = data->orig_offset; > > #endif > > 1313a1322,1329 > > > > #ifdef CONFIG_NFS_V4 > > /* Restore the data->args->offset pointer to the actual offset > > * if it was changed > > */ > > if (data->orig_offset) > > data->args.offset = data->orig_offset; > > #endif Index: include/linux/nfs_xdr.h =================================================================== RCS file: /cvs/nfsv4/cvs/pnfs/include/linux/nfs_xdr.h,v retrieving revision 1.13 diff -r1.13 nfs_xdr.h 702a703 > > __u64 orig_offset; 729a731 > > __u64 orig_offset