Blame view
fs/nfs/internal.h
12.8 KB
f7b422b17 NFS: Split fs/nfs... |
1 2 3 |
/* * NFS internal definitions */ |
eedc020e7 nfs41: use rpc pr... |
4 |
#include "nfs4_fs.h" |
f7b422b17 NFS: Split fs/nfs... |
5 |
#include <linux/mount.h> |
f9c3a3802 NFS: use new LSM ... |
6 |
#include <linux/security.h> |
f7b422b17 NFS: Split fs/nfs... |
7 |
|
08734048b NFS: Define and c... |
8 |
#define NFS_MS_MASK (MS_RDONLY|MS_NOSUID|MS_NODEV|MS_NOEXEC|MS_SYNCHRONOUS) |
54ceac451 NFS: Share NFS su... |
9 |
struct nfs_string; |
54ceac451 NFS: Share NFS su... |
10 11 12 13 14 15 16 17 |
/* Maximum number of readahead requests * FIXME: this should really be a sysctl so that users may tune it to suit * their needs. People that do NFS over a slow network, might for * instance want to reduce it to something closer to 1 for improved * interactive response. */ #define NFS_MAX_READAHEAD (RPC_DEF_SLOT_TABLE - 1) |
eedc020e7 nfs41: use rpc pr... |
18 19 20 21 22 23 24 25 26 27 28 |
/* * Determine if sessions are in use. */ static inline int nfs4_has_session(const struct nfs_client *clp) { #ifdef CONFIG_NFS_V4_1 if (clp->cl_session) return 1; #endif /* CONFIG_NFS_V4_1 */ return 0; } |
d8cb1a7ce nfs41: check if s... |
29 30 31 32 33 34 35 36 |
static inline int nfs4_has_persistent_session(const struct nfs_client *clp) { #ifdef CONFIG_NFS_V4_1 if (nfs4_has_session(clp)) return (clp->cl_session->flags & SESSION4_PERSIST); #endif /* CONFIG_NFS_V4_1 */ return 0; } |
7ebb93159 NFS: use secinfo ... |
37 38 39 40 41 |
static inline void nfs_attr_check_mountpoint(struct super_block *parent, struct nfs_fattr *fattr) { if (!nfs_fsid_equal(&NFS_SB(parent)->fsid, &fattr->fsid)) fattr->valid |= NFS_ATTR_FATTR_MOUNTPOINT; } |
533eb4611 NFSv4.1: allow nf... |
42 43 44 45 46 47 48 49 50 51 |
static inline int nfs_attr_use_mounted_on_fileid(struct nfs_fattr *fattr) { if (((fattr->valid & NFS_ATTR_FATTR_MOUNTED_ON_FILEID) == 0) || (((fattr->valid & NFS_ATTR_FATTR_MOUNTPOINT) == 0) && ((fattr->valid & NFS_ATTR_FATTR_V4_REFERRAL) == 0))) return 0; fattr->fileid = fattr->mounted_on_fileid; return 1; } |
f7b422b17 NFS: Split fs/nfs... |
52 53 54 55 56 57 58 |
struct nfs_clone_mount { const struct super_block *sb; const struct dentry *dentry; struct nfs_fh *fh; struct nfs_fattr *fattr; char *hostname; char *mnt_path; |
6677d0951 NFS: Adjust nfs_c... |
59 60 |
struct sockaddr *addr; size_t addrlen; |
f7b422b17 NFS: Split fs/nfs... |
61 62 |
rpc_authflavor_t authflavor; }; |
6b18eaa08 NFS: move nfs_par... |
63 |
/* |
a14017db2 NFS: add XDR deco... |
64 65 66 67 68 69 |
* Note: RFC 1813 doesn't limit the number of auth flavors that * a server can return, so make something up. */ #define NFS_MAX_SECFLAVORS (12) /* |
4cfd74fc9 NFS: Mount option... |
70 71 72 73 74 |
* Value used if the user did not specify a port value. */ #define NFS_UNSPEC_PORT (-1) /* |
56e4ebf87 NFS: readdir with... |
75 76 77 78 79 80 |
* Maximum number of pages that readdir can use for creating * a vmapped array of pages. */ #define NFS_MAX_READDIR_PAGES 8 /* |
6b18eaa08 NFS: move nfs_par... |
81 82 83 84 85 86 87 88 89 |
* In-kernel mount arguments */ struct nfs_parsed_mount_data { int flags; int rsize, wsize; int timeo, retrans; int acregmin, acregmax, acdirmin, acdirmax; int namlen; |
b797cac74 NFS: Add mount op... |
90 |
unsigned int options; |
6b18eaa08 NFS: move nfs_par... |
91 92 93 94 |
unsigned int bsize; unsigned int auth_flavor_len; rpc_authflavor_t auth_flavors[1]; char *client_address; |
764302ccb NFS: Allow the "n... |
95 |
unsigned int version; |
3fd5be9e1 nfs41: add mount ... |
96 |
unsigned int minorversion; |
08734048b NFS: Define and c... |
97 |
char *fscache_uniq; |
6b18eaa08 NFS: move nfs_par... |
98 99 |
struct { |
4c5680177 NFS: Support non-... |
100 101 |
struct sockaddr_storage address; size_t addrlen; |
6b18eaa08 NFS: move nfs_par... |
102 |
char *hostname; |
78fa701f3 NFS: Fix up data ... |
103 |
u32 version; |
4cfd74fc9 NFS: Mount option... |
104 |
int port; |
78fa701f3 NFS: Fix up data ... |
105 |
unsigned short protocol; |
6b18eaa08 NFS: move nfs_par... |
106 107 108 |
} mount_server; struct { |
4c5680177 NFS: Support non-... |
109 110 |
struct sockaddr_storage address; size_t addrlen; |
6b18eaa08 NFS: move nfs_par... |
111 112 |
char *hostname; char *export_path; |
4cfd74fc9 NFS: Mount option... |
113 |
int port; |
78fa701f3 NFS: Fix up data ... |
114 |
unsigned short protocol; |
6b18eaa08 NFS: move nfs_par... |
115 |
} nfs_server; |
f9c3a3802 NFS: use new LSM ... |
116 117 |
struct security_mnt_opts lsm_opts; |
6b18eaa08 NFS: move nfs_par... |
118 |
}; |
146ec944b NFS: Move declara... |
119 |
/* mount_clnt.c */ |
c5d120f8e NFS: introduce nf... |
120 121 122 123 124 125 126 127 |
struct nfs_mount_request { struct sockaddr *sap; size_t salen; char *hostname; char *dirpath; u32 version; unsigned short protocol; struct nfs_fh *fh; |
50a737f86 NFS: "[no]resvpor... |
128 |
int noresvport; |
8e02f6b9a NFS: Update MNT a... |
129 130 |
unsigned int *auth_flav_len; rpc_authflavor_t *auth_flavs; |
c5d120f8e NFS: introduce nf... |
131 132 133 |
}; extern int nfs_mount(struct nfs_mount_request *info); |
0b524123c NFS: Add ability ... |
134 |
extern void nfs_umount(const struct nfs_mount_request *info); |
146ec944b NFS: Move declara... |
135 |
|
24c8dbbb5 NFS: Generalise t... |
136 |
/* client.c */ |
54ceac451 NFS: Share NFS su... |
137 |
extern struct rpc_program nfs_program; |
f4eecd5da NFS implement v4.... |
138 |
extern void nfs_cleanup_cb_ident_idr(void); |
24c8dbbb5 NFS: Generalise t... |
139 |
extern void nfs_put_client(struct nfs_client *); |
c36fca52f NFS refactor nfs_... |
140 141 142 |
extern struct nfs_client *nfs4_find_client_no_ident(const struct sockaddr *); extern struct nfs_client *nfs4_find_client_ident(int); extern struct nfs_client * |
778be232a NFS do not find c... |
143 |
nfs4_find_client_sessionid(const struct sockaddr *, struct nfs4_sessionid *); |
2283f8d6e NFS: use in-kerne... |
144 145 146 |
extern struct nfs_server *nfs_create_server( const struct nfs_parsed_mount_data *, struct nfs_fh *); |
91ea40b9c NFS: use in-kerne... |
147 148 149 |
extern struct nfs_server *nfs4_create_server( const struct nfs_parsed_mount_data *, struct nfs_fh *); |
54ceac451 NFS: Share NFS su... |
150 151 152 153 154 155 |
extern struct nfs_server *nfs4_create_referral_server(struct nfs_clone_mount *, struct nfs_fh *); extern void nfs_free_server(struct nfs_server *server); extern struct nfs_server *nfs_clone_server(struct nfs_server *, struct nfs_fh *, struct nfs_fattr *); |
76db6d950 nfs41: add sessio... |
156 |
extern void nfs_mark_client_ready(struct nfs_client *clp, int state); |
008f55d0e nfs41: recover le... |
157 |
extern int nfs4_check_client_ready(struct nfs_client *clp); |
d83217c13 NFSv4.1: data ser... |
158 159 160 |
extern struct nfs_client *nfs4_set_ds_client(struct nfs_client* mds_clp, const struct sockaddr *ds_addr, int ds_addrlen, int ds_proto); |
6aaca5665 NFS: Add server a... |
161 162 163 164 165 166 167 168 169 170 171 172 |
#ifdef CONFIG_PROC_FS extern int __init nfs_fs_proc_init(void); extern void nfs_fs_proc_exit(void); #else static inline int nfs_fs_proc_init(void) { return 0; } static inline void nfs_fs_proc_exit(void) { } #endif |
24c8dbbb5 NFS: Generalise t... |
173 |
|
7d4e2747a NFS: Fix up split... |
174 |
/* nfs4namespace.c */ |
f7b422b17 NFS: Split fs/nfs... |
175 |
#ifdef CONFIG_NFS_V4 |
f8ad9c4ba nfs: nfs_do_{ref,... |
176 |
extern struct vfsmount *nfs_do_refmount(struct dentry *dentry); |
f7b422b17 NFS: Split fs/nfs... |
177 178 |
#else static inline |
f8ad9c4ba nfs: nfs_do_{ref,... |
179 |
struct vfsmount *nfs_do_refmount(struct dentry *dentry) |
f7b422b17 NFS: Split fs/nfs... |
180 181 182 183 184 185 186 |
{ return ERR_PTR(-ENOENT); } #endif /* callback_xdr.c */ extern struct svc_version nfs4_callback_version1; |
07bccc2dd nfs41: add suppor... |
187 |
extern struct svc_version nfs4_callback_version4; |
f7b422b17 NFS: Split fs/nfs... |
188 189 190 |
/* pagelist.c */ extern int __init nfs_init_nfspagecache(void); |
266bee886 [PATCH] fix stati... |
191 |
extern void nfs_destroy_nfspagecache(void); |
f7b422b17 NFS: Split fs/nfs... |
192 |
extern int __init nfs_init_readpagecache(void); |
266bee886 [PATCH] fix stati... |
193 |
extern void nfs_destroy_readpagecache(void); |
f7b422b17 NFS: Split fs/nfs... |
194 |
extern int __init nfs_init_writepagecache(void); |
266bee886 [PATCH] fix stati... |
195 |
extern void nfs_destroy_writepagecache(void); |
f7b422b17 NFS: Split fs/nfs... |
196 |
|
f7b422b17 NFS: Split fs/nfs... |
197 |
extern int __init nfs_init_directcache(void); |
266bee886 [PATCH] fix stati... |
198 |
extern void nfs_destroy_directcache(void); |
f7b422b17 NFS: Split fs/nfs... |
199 200 |
/* nfs2xdr.c */ |
858284932 NFS: Use the "nfs... |
201 |
extern int nfs_stat_to_errno(enum nfs_stat); |
f7b422b17 NFS: Split fs/nfs... |
202 |
extern struct rpc_procinfo nfs_procedures[]; |
573c4e1ef NFS: Simplify ->d... |
203 204 |
extern int nfs2_decode_dirent(struct xdr_stream *, struct nfs_entry *, int); |
f7b422b17 NFS: Split fs/nfs... |
205 206 207 |
/* nfs3xdr.c */ extern struct rpc_procinfo nfs3_procedures[]; |
573c4e1ef NFS: Simplify ->d... |
208 209 |
extern int nfs3_decode_dirent(struct xdr_stream *, struct nfs_entry *, int); |
f7b422b17 NFS: Split fs/nfs... |
210 211 |
/* nfs4xdr.c */ |
7d4e2747a NFS: Fix up split... |
212 |
#ifdef CONFIG_NFS_V4 |
573c4e1ef NFS: Simplify ->d... |
213 214 |
extern int nfs4_decode_dirent(struct xdr_stream *, struct nfs_entry *, int); |
7d4e2747a NFS: Fix up split... |
215 |
#endif |
2449ea2e1 nfs41: V2 adjust ... |
216 217 218 219 |
#ifdef CONFIG_NFS_V4_1 extern const u32 nfs41_maxread_overhead; extern const u32 nfs41_maxwrite_overhead; #endif |
f7b422b17 NFS: Split fs/nfs... |
220 221 |
/* nfs4proc.c */ |
d75d54147 git-nfs-build-fixes |
222 |
#ifdef CONFIG_NFS_V4 |
f7b422b17 NFS: Split fs/nfs... |
223 |
extern struct rpc_procinfo nfs4_procedures[]; |
7ebb93159 NFS: use secinfo ... |
224 |
void nfs_fixup_secinfo_attributes(struct nfs_fattr *, struct nfs_fh *); |
d75d54147 git-nfs-build-fixes |
225 |
#endif |
f7b422b17 NFS: Split fs/nfs... |
226 |
|
d83217c13 NFSv4.1: data ser... |
227 |
extern int nfs4_init_ds_session(struct nfs_client *clp); |
7fe5c398f NFS: Optimise NFS... |
228 229 |
/* proc.c */ void nfs_close_context(struct nfs_open_context *ctx, int is_sync); |
45a52a020 NFS move nfs_clie... |
230 231 232 233 |
extern int nfs_init_client(struct nfs_client *clp, const struct rpc_timeout *timeparms, const char *ip_addr, rpc_authflavor_t authflavour, int noresvport); |
7fe5c398f NFS: Optimise NFS... |
234 |
|
979df72e6 NFS: Add an ACCES... |
235 |
/* dir.c */ |
7f8275d0d mm: add context a... |
236 |
extern int nfs_access_cache_shrinker(struct shrinker *shrink, |
1495f230f vmscan: change sh... |
237 |
struct shrink_control *sc); |
979df72e6 NFS: Add an ACCES... |
238 |
|
f7b422b17 NFS: Split fs/nfs... |
239 |
/* inode.c */ |
5746006f1 NFS: Add an nfsio... |
240 |
extern struct workqueue_struct *nfsiod_workqueue; |
f7b422b17 NFS: Split fs/nfs... |
241 242 |
extern struct inode *nfs_alloc_inode(struct super_block *sb); extern void nfs_destroy_inode(struct inode *); |
a9185b41a pass writeback_co... |
243 |
extern int nfs_write_inode(struct inode *, struct writeback_control *); |
b57922d97 convert remaining... |
244 |
extern void nfs_evict_inode(struct inode *); |
f7b422b17 NFS: Split fs/nfs... |
245 |
#ifdef CONFIG_NFS_V4 |
b57922d97 convert remaining... |
246 |
extern void nfs4_evict_inode(struct inode *); |
f7b422b17 NFS: Split fs/nfs... |
247 |
#endif |
f41f74183 NFS: Ensure we za... |
248 |
void nfs_zap_acl_cache(struct inode *inode); |
72cb77f4a NFS: Throttle pag... |
249 |
extern int nfs_wait_bit_killable(void *word); |
f7b422b17 NFS: Split fs/nfs... |
250 251 |
/* super.c */ |
54ceac451 NFS: Share NFS su... |
252 |
extern struct file_system_type nfs_xdev_fs_type; |
f7b422b17 NFS: Split fs/nfs... |
253 |
#ifdef CONFIG_NFS_V4 |
54ceac451 NFS: Share NFS su... |
254 255 |
extern struct file_system_type nfs4_xdev_fs_type; extern struct file_system_type nfs4_referral_fs_type; |
f7b422b17 NFS: Split fs/nfs... |
256 |
#endif |
4ebd9ab38 [PATCH] nfs: non-... |
257 |
|
f7b422b17 NFS: Split fs/nfs... |
258 |
extern struct rpc_stat nfs_rpcstat; |
4ebd9ab38 [PATCH] nfs: non-... |
259 |
|
f7b422b17 NFS: Split fs/nfs... |
260 261 |
extern int __init register_nfs_fs(void); extern void __exit unregister_nfs_fs(void); |
1daef0a86 NFS: Clean up nfs... |
262 263 |
extern void nfs_sb_active(struct super_block *sb); extern void nfs_sb_deactive(struct super_block *sb); |
f7b422b17 NFS: Split fs/nfs... |
264 265 |
/* namespace.c */ |
b514f872f nfs: make nfs_pat... |
266 |
extern char *nfs_path(char **p, struct dentry *dentry, |
f7b422b17 NFS: Split fs/nfs... |
267 |
char *buffer, ssize_t buflen); |
36d43a437 NFS: Use d_automo... |
268 |
extern struct vfsmount *nfs_d_automount(struct path *path); |
fca78d6d2 NFS: Add SECINFO_... |
269 270 271 |
#ifdef CONFIG_NFS_V4 rpc_authflavor_t nfs_find_best_sec(struct nfs4_secinfo_flavors *); #endif |
f7b422b17 NFS: Split fs/nfs... |
272 |
|
54ceac451 NFS: Share NFS su... |
273 |
/* getroot.c */ |
0d5839ad0 nfs: propagate de... |
274 275 |
extern struct dentry *nfs_get_root(struct super_block *, struct nfs_fh *, const char *); |
7d4e2747a NFS: Fix up split... |
276 |
#ifdef CONFIG_NFS_V4 |
0d5839ad0 nfs: propagate de... |
277 278 |
extern struct dentry *nfs4_get_root(struct super_block *, struct nfs_fh *, const char *); |
54ceac451 NFS: Share NFS su... |
279 |
|
815409d22 NFSv4: Eliminate ... |
280 |
extern int nfs4_get_rootfh(struct nfs_server *server, struct nfs_fh *mntfh); |
7d4e2747a NFS: Fix up split... |
281 |
#endif |
f7b422b17 NFS: Split fs/nfs... |
282 |
|
493292ddc NFS: Move the pnf... |
283 |
struct nfs_pageio_descriptor; |
f11c88af2 nfs41: read seque... |
284 |
/* read.c */ |
dc70d7b31 NFSv4.1: filelayo... |
285 286 |
extern int nfs_initiate_read(struct nfs_read_data *data, struct rpc_clnt *clnt, const struct rpc_call_ops *call_ops); |
f11c88af2 nfs41: read seque... |
287 |
extern void nfs_read_prepare(struct rpc_task *task, void *calldata); |
493292ddc NFS: Move the pnf... |
288 289 |
extern int nfs_generic_pagein(struct nfs_pageio_descriptor *desc, struct list_head *head); |
f11c88af2 nfs41: read seque... |
290 |
|
62e4a7698 NFS: Revert pnfs ... |
291 292 |
extern void nfs_pageio_init_read_mds(struct nfs_pageio_descriptor *pgio, struct inode *inode); |
493292ddc NFS: Move the pnf... |
293 294 |
extern void nfs_pageio_reset_read_mds(struct nfs_pageio_descriptor *pgio); extern void nfs_readdata_release(struct nfs_read_data *rdata); |
e885de1a5 NFSv4.1: Fall bac... |
295 |
|
def6ed7ef nfs41 write seque... |
296 |
/* write.c */ |
dce81290e NFS: Move the pnf... |
297 298 |
extern int nfs_generic_flush(struct nfs_pageio_descriptor *desc, struct list_head *head); |
e2fecb215 NFS: Remove pNFS ... |
299 300 |
extern void nfs_pageio_init_write_mds(struct nfs_pageio_descriptor *pgio, struct inode *inode, int ioflags); |
dce81290e NFS: Move the pnf... |
301 302 |
extern void nfs_pageio_reset_write_mds(struct nfs_pageio_descriptor *pgio); extern void nfs_writedata_release(struct nfs_write_data *wdata); |
e0c2b3801 NFSv4.1: filelayo... |
303 |
extern void nfs_commit_free(struct nfs_write_data *p); |
a69aef149 NFSv4.1: pnfs fil... |
304 305 306 307 |
extern int nfs_initiate_write(struct nfs_write_data *data, struct rpc_clnt *clnt, const struct rpc_call_ops *call_ops, int how); |
def6ed7ef nfs41 write seque... |
308 |
extern void nfs_write_prepare(struct rpc_task *task, void *calldata); |
e0c2b3801 NFSv4.1: filelayo... |
309 310 311 312 313 314 315 316 317 318 319 320 |
extern int nfs_initiate_commit(struct nfs_write_data *data, struct rpc_clnt *clnt, const struct rpc_call_ops *call_ops, int how); extern void nfs_init_commit(struct nfs_write_data *data, struct list_head *head, struct pnfs_layout_segment *lseg); void nfs_retry_commit(struct list_head *page_list, struct pnfs_layout_segment *lseg); void nfs_commit_clear_lock(struct nfs_inode *nfsi); void nfs_commitdata_release(void *data); void nfs_commit_release_pages(struct nfs_write_data *data); |
074cc1dee NFS: Add a ->migr... |
321 322 |
#ifdef CONFIG_MIGRATION extern int nfs_migrate_page(struct address_space *, |
a6bc32b89 mm: compaction: i... |
323 |
struct page *, struct page *, enum migrate_mode); |
074cc1dee NFS: Add a ->migr... |
324 325 326 |
#else #define nfs_migrate_page NULL #endif |
def6ed7ef nfs41 write seque... |
327 |
|
cccef3b96 nfs41: introduce ... |
328 |
/* nfs4proc.c */ |
d20581aa4 pnfs: support for... |
329 |
extern void __nfs4_read_done_cb(struct nfs_read_data *); |
cbdabc7f8 NFSv4.1: filelayo... |
330 |
extern void nfs4_reset_read(struct rpc_task *task, struct nfs_read_data *data); |
45a52a020 NFS move nfs_clie... |
331 332 333 334 335 |
extern int nfs4_init_client(struct nfs_client *clp, const struct rpc_timeout *timeparms, const char *ip_addr, rpc_authflavor_t authflavour, int noresvport); |
a69aef149 NFSv4.1: pnfs fil... |
336 |
extern void nfs4_reset_write(struct rpc_task *task, struct nfs_write_data *data); |
7c5130588 NFS: lookup suppo... |
337 338 |
extern int _nfs4_call_sync(struct rpc_clnt *clnt, struct nfs_server *server, |
cccef3b96 nfs41: introduce ... |
339 340 341 342 |
struct rpc_message *msg, struct nfs4_sequence_args *args, struct nfs4_sequence_res *res, int cache_reply); |
7c5130588 NFS: lookup suppo... |
343 344 |
extern int _nfs4_call_sync_session(struct rpc_clnt *clnt, struct nfs_server *server, |
cccef3b96 nfs41: introduce ... |
345 346 347 348 |
struct rpc_message *msg, struct nfs4_sequence_args *args, struct nfs4_sequence_res *res, int cache_reply); |
557134a39 nfs41: sessions c... |
349 |
/* |
f7b422b17 NFS: Split fs/nfs... |
350 351 |
* Determine the device name as a string */ |
b514f872f nfs: make nfs_pat... |
352 |
static inline char *nfs_devname(struct dentry *dentry, |
54ceac451 NFS: Share NFS su... |
353 |
char *buffer, ssize_t buflen) |
f7b422b17 NFS: Split fs/nfs... |
354 |
{ |
b514f872f nfs: make nfs_pat... |
355 356 |
char *dummy; return nfs_path(&dummy, dentry, buffer, buflen); |
f7b422b17 NFS: Split fs/nfs... |
357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 |
} /* * Determine the actual block size (and log2 thereof) */ static inline unsigned long nfs_block_bits(unsigned long bsize, unsigned char *nrbitsp) { /* make sure blocksize is a power of two */ if ((bsize & (bsize - 1)) || nrbitsp) { unsigned char nrbits; for (nrbits = 31; nrbits && !(bsize & (1 << nrbits)); nrbits--) ; bsize = 1 << nrbits; if (nrbitsp) *nrbitsp = nrbits; } return bsize; } /* * Calculate the number of 512byte blocks used. */ |
9eaa67c6a NFS: Clean-up: us... |
382 |
static inline blkcnt_t nfs_calc_block_size(u64 tsize) |
f7b422b17 NFS: Split fs/nfs... |
383 |
{ |
9eaa67c6a NFS: Clean-up: us... |
384 |
blkcnt_t used = (tsize + 511) >> 9; |
f7b422b17 NFS: Split fs/nfs... |
385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 |
return (used > ULONG_MAX) ? ULONG_MAX : used; } /* * Compute and set NFS server blocksize */ static inline unsigned long nfs_block_size(unsigned long bsize, unsigned char *nrbitsp) { if (bsize < NFS_MIN_FILE_IO_SIZE) bsize = NFS_DEF_FILE_IO_SIZE; else if (bsize >= NFS_MAX_FILE_IO_SIZE) bsize = NFS_MAX_FILE_IO_SIZE; return nfs_block_bits(bsize, nrbitsp); } /* * Determine the maximum file size for a superblock */ static inline void nfs_super_set_maxbytes(struct super_block *sb, __u64 maxfilesize) { sb->s_maxbytes = (loff_t)maxfilesize; if (sb->s_maxbytes > MAX_LFS_FILESIZE || sb->s_maxbytes <= 0) sb->s_maxbytes = MAX_LFS_FILESIZE; } |
49a70f278 NFS: Cleanup: add... |
412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 |
/* * Determine the number of bytes of data the page contains */ static inline unsigned int nfs_page_length(struct page *page) { loff_t i_size = i_size_read(page->mapping->host); if (i_size > 0) { pgoff_t end_index = (i_size - 1) >> PAGE_CACHE_SHIFT; if (page->index < end_index) return PAGE_CACHE_SIZE; if (page->index == end_index) return ((i_size - 1) & ~PAGE_CACHE_MASK) + 1; } return 0; } |
8d5658c94 NFS: Fix a buffer... |
430 431 |
/* |
0b26a0bf6 NFS: Ensure we re... |
432 433 434 435 436 437 438 439 440 |
* Convert a umode to a dirent->d_type */ static inline unsigned char nfs_umode_to_dtype(umode_t mode) { return (mode >> 12) & 15; } /* |
8d5658c94 NFS: Fix a buffer... |
441 442 443 444 445 446 447 448 449 |
* Determine the number of pages in an array of length 'len' and * with a base offset of 'base' */ static inline unsigned int nfs_page_array_len(unsigned int base, size_t len) { return ((unsigned long)len + (unsigned long)base + PAGE_SIZE - 1) >> PAGE_SHIFT; } |
0110ee152 NFS: Fix up the d... |
450 |