]>
Commit | Line | Data |
---|---|---|
d7e09d03 PT |
1 | /* |
2 | * GPL HEADER START | |
3 | * | |
4 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | |
5 | * | |
6 | * This program is free software; you can redistribute it and/or modify | |
7 | * it under the terms of the GNU General Public License version 2 only, | |
8 | * as published by the Free Software Foundation. | |
9 | * | |
10 | * This program is distributed in the hope that it will be useful, but | |
11 | * WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 | * General Public License version 2 for more details (a copy is included | |
14 | * in the LICENSE file that accompanied this code). | |
15 | * | |
16 | * You should have received a copy of the GNU General Public License | |
17 | * version 2 along with this program; If not, see | |
6a5b99a4 | 18 | * http://www.gnu.org/licenses/gpl-2.0.html |
d7e09d03 | 19 | * |
d7e09d03 PT |
20 | * GPL HEADER END |
21 | */ | |
22 | /* | |
23 | * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. | |
24 | * Use is subject to license terms. | |
25 | * | |
1dc563a6 | 26 | * Copyright (c) 2011, 2015, Intel Corporation. |
d7e09d03 PT |
27 | */ |
28 | /* | |
29 | * This file is part of Lustre, http://www.lustre.org/ | |
30 | * Lustre is a trademark of Sun Microsystems, Inc. | |
31 | */ | |
32 | ||
33 | #ifndef LLITE_INTERNAL_H | |
34 | #define LLITE_INTERNAL_H | |
67a235f5 GKH |
35 | #include "../include/lustre_debug.h" |
36 | #include "../include/lustre_ver.h" | |
37 | #include "../include/lustre_disk.h" /* for s2sbi */ | |
38 | #include "../include/lustre_eacl.h" | |
a6d879fd | 39 | #include "../include/lustre_linkea.h" |
d7e09d03 PT |
40 | |
41 | /* for struct cl_lock_descr and struct cl_io */ | |
23ec6607 JH |
42 | #include "../include/lustre_patchless_compat.h" |
43 | #include "../include/lustre_compat.h" | |
67a235f5 | 44 | #include "../include/cl_object.h" |
2de35386 | 45 | #include "../include/lustre_lmv.h" |
67a235f5 | 46 | #include "../include/lustre_mdc.h" |
00d65ec8 | 47 | #include "../include/lustre_intent.h" |
c7c99012 | 48 | #include <linux/compat.h> |
23ec6607 | 49 | #include <linux/namei.h> |
2c563880 | 50 | #include <linux/xattr.h> |
04eb2b7f | 51 | #include <linux/posix_acl_xattr.h> |
0d345656 | 52 | #include "vvp_internal.h" |
5b8a39c5 | 53 | #include "range_lock.h" |
d7e09d03 PT |
54 | |
55 | #ifndef FMODE_EXEC | |
56 | #define FMODE_EXEC 0 | |
57 | #endif | |
58 | ||
59 | #ifndef VM_FAULT_RETRY | |
60 | #define VM_FAULT_RETRY 0 | |
61 | #endif | |
62 | ||
d7e09d03 PT |
63 | /** Only used on client-side for indicating the tail of dir hash/offset. */ |
64 | #define LL_DIR_END_OFF 0x7fffffffffffffffULL | |
65 | #define LL_DIR_END_OFF_32BIT 0x7fffffffUL | |
66 | ||
f9acb591 JH |
67 | /* 4UL * 1024 * 1024 */ |
68 | #define LL_MAX_BLKSIZE_BITS 22 | |
69 | ||
d7e09d03 PT |
70 | #define LL_IT2STR(it) ((it) ? ldlm_it2str((it)->it_op) : "0") |
71 | #define LUSTRE_FPRIVATE(file) ((file)->private_data) | |
72 | ||
73 | struct ll_dentry_data { | |
d7e09d03 PT |
74 | struct lookup_intent *lld_it; |
75 | unsigned int lld_sa_generation; | |
76 | unsigned int lld_invalid:1; | |
6dad4d89 | 77 | unsigned int lld_nfs_dentry:1; |
d7e09d03 PT |
78 | struct rcu_head lld_rcu_head; |
79 | }; | |
80 | ||
b2952d62 | 81 | #define ll_d2d(de) ((struct ll_dentry_data *)((de)->d_fsdata)) |
d7e09d03 | 82 | |
d7e09d03 PT |
83 | #define LLI_INODE_MAGIC 0x111d0de5 |
84 | #define LLI_INODE_DEAD 0xdeadd00d | |
85 | ||
d7e09d03 | 86 | struct ll_getname_data { |
0b09d381 | 87 | struct dir_context ctx; |
d7e09d03 PT |
88 | char *lgd_name; /* points to a buffer with NAME_MAX+1 size */ |
89 | struct lu_fid lgd_fid; /* target fid we are looking for */ | |
90 | int lgd_found; /* inode matched? */ | |
91 | }; | |
92 | ||
98eae5e7 JH |
93 | struct ll_grouplock { |
94 | struct lu_env *lg_env; | |
95 | struct cl_io *lg_io; | |
96 | struct cl_lock *lg_lock; | |
97 | unsigned long lg_gid; | |
98 | }; | |
99 | ||
219c0c45 | 100 | enum ll_file_flags { |
d7e09d03 | 101 | /* File data is modified. */ |
219c0c45 | 102 | LLIF_DATA_MODIFIED = 0, |
5ea17d6c | 103 | /* File is being restored */ |
219c0c45 | 104 | LLIF_FILE_RESTORING = 1, |
7fc1f831 | 105 | /* Xattr cache is attached to the file */ |
219c0c45 | 106 | LLIF_XATTR_CACHE = 2, |
d7e09d03 PT |
107 | }; |
108 | ||
109 | struct ll_inode_info { | |
110 | __u32 lli_inode_magic; | |
d7e09d03 PT |
111 | |
112 | spinlock_t lli_lock; | |
219c0c45 | 113 | unsigned long lli_flags; |
d7e09d03 PT |
114 | struct posix_acl *lli_posix_acl; |
115 | ||
d7e09d03 PT |
116 | /* identifying fields for both metadata and data stacks. */ |
117 | struct lu_fid lli_fid; | |
c1b66fcc | 118 | /* master inode fid for stripe directory */ |
d7e09d03 PT |
119 | struct lu_fid lli_pfid; |
120 | ||
d7e09d03 | 121 | /* We need all three because every inode may be opened in different |
c0894c6c OD |
122 | * modes |
123 | */ | |
d7e09d03 PT |
124 | struct obd_client_handle *lli_mds_read_och; |
125 | struct obd_client_handle *lli_mds_write_och; | |
126 | struct obd_client_handle *lli_mds_exec_och; | |
127 | __u64 lli_open_fd_read_count; | |
128 | __u64 lli_open_fd_write_count; | |
129 | __u64 lli_open_fd_exec_count; | |
130 | /* Protects access to och pointers and their usage counters */ | |
131 | struct mutex lli_och_mutex; | |
132 | ||
133 | struct inode lli_vfs_inode; | |
134 | ||
135 | /* the most recent timestamps obtained from mds */ | |
d2995737 JH |
136 | s64 lli_atime; |
137 | s64 lli_mtime; | |
138 | s64 lli_ctime; | |
d7e09d03 PT |
139 | spinlock_t lli_agl_lock; |
140 | ||
141 | /* Try to make the d::member and f::member are aligned. Before using | |
c0894c6c OD |
142 | * these members, make clear whether it is directory or not. |
143 | */ | |
d7e09d03 PT |
144 | union { |
145 | /* for directory */ | |
146 | struct { | |
147 | /* serialize normal readdir and statahead-readdir. */ | |
5231f765 | 148 | struct mutex lli_readdir_mutex; |
d7e09d03 PT |
149 | |
150 | /* metadata statahead */ | |
151 | /* since parent-child threads can share the same @file | |
152 | * struct, "opendir_key" is the token when dir close for | |
153 | * case of parent exit before child -- it is me should | |
c0894c6c OD |
154 | * cleanup the dir readahead. |
155 | */ | |
5231f765 LS |
156 | void *lli_opendir_key; |
157 | struct ll_statahead_info *lli_sai; | |
d7e09d03 | 158 | /* protect statahead stuff. */ |
5231f765 | 159 | spinlock_t lli_sa_lock; |
c0894c6c OD |
160 | /* "opendir_pid" is the token when lookup/revalidate |
161 | * -- I am the owner of dir statahead. | |
162 | */ | |
5231f765 | 163 | pid_t lli_opendir_pid; |
e9792be1 LS |
164 | /* stat will try to access statahead entries or start |
165 | * statahead if this flag is set, and this flag will be | |
166 | * set upon dir open, and cleared when dir is closed, | |
167 | * statahead hit ratio is too low, or start statahead | |
168 | * thread failed. | |
169 | */ | |
5231f765 LS |
170 | unsigned int lli_sa_enabled:1; |
171 | /* generation for statahead */ | |
172 | unsigned int lli_sa_generation; | |
1c12cf63 | 173 | /* directory stripe information */ |
5231f765 | 174 | struct lmv_stripe_md *lli_lsm_md; |
d81e9009 | 175 | /* default directory stripe offset. This is extracted |
176 | * from the "dmv" xattr in order to decide which MDT to | |
177 | * create a subdirectory on. The MDS itself fetches | |
178 | * "dmv" and gets the rest of the default layout itself | |
179 | * (count, hash, etc). | |
180 | */ | |
181 | __u32 lli_def_stripe_offset; | |
5231f765 | 182 | }; |
d7e09d03 PT |
183 | |
184 | /* for non-directory */ | |
185 | struct { | |
5231f765 LS |
186 | struct mutex lli_size_mutex; |
187 | char *lli_symlink_name; | |
d7e09d03 PT |
188 | /* |
189 | * struct rw_semaphore { | |
190 | * signed long count; // align d.d_def_acl | |
191 | * spinlock_t wait_lock; // align d.d_sa_lock | |
192 | * struct list_head wait_list; | |
193 | * } | |
194 | */ | |
5231f765 LS |
195 | struct rw_semaphore lli_trunc_sem; |
196 | struct range_lock_tree lli_write_tree; | |
d7e09d03 | 197 | |
5231f765 LS |
198 | struct rw_semaphore lli_glimpse_sem; |
199 | unsigned long lli_glimpse_time; | |
200 | struct list_head lli_agl_list; | |
201 | __u64 lli_agl_index; | |
d7e09d03 PT |
202 | |
203 | /* for writepage() only to communicate to fsync */ | |
5231f765 | 204 | int lli_async_rc; |
d7e09d03 | 205 | |
d7e09d03 PT |
206 | /* |
207 | * whenever a process try to read/write the file, the | |
208 | * jobid of the process will be saved here, and it'll | |
209 | * be packed into the write PRC when flush later. | |
210 | * | |
211 | * so the read/write statistics for jobid will not be | |
212 | * accurate if the file is shared by different jobs. | |
213 | */ | |
5231f765 LS |
214 | char lli_jobid[LUSTRE_JOBID_SIZE]; |
215 | }; | |
216 | }; | |
d7e09d03 PT |
217 | |
218 | /* XXX: For following frequent used members, although they maybe special | |
219 | * used for non-directory object, it is some time-wasting to check | |
220 | * whether the object is directory or not before using them. On the | |
221 | * other hand, currently, sizeof(f) > sizeof(d), it cannot reduce | |
222 | * the "ll_inode_info" size even if moving those members into u.f. | |
223 | * So keep them out side. | |
224 | * | |
225 | * In the future, if more members are added only for directory, | |
226 | * some of the following members can be moved into u.f. | |
227 | */ | |
d7e09d03 PT |
228 | struct cl_object *lli_clob; |
229 | ||
230 | /* mutex to request for layout lock exclusively. */ | |
231 | struct mutex lli_layout_mutex; | |
09aed8a5 | 232 | /* Layout version, protected by lli_layout_lock */ |
d7e09d03 | 233 | __u32 lli_layout_gen; |
09aed8a5 | 234 | spinlock_t lli_layout_lock; |
7fc1f831 AP |
235 | |
236 | struct rw_semaphore lli_xattrs_list_rwsem; | |
237 | struct mutex lli_xattrs_enq_lock; | |
238 | struct list_head lli_xattrs;/* ll_xattr_entry->xe_list */ | |
d7e09d03 PT |
239 | }; |
240 | ||
09aed8a5 JX |
241 | static inline __u32 ll_layout_version_get(struct ll_inode_info *lli) |
242 | { | |
243 | __u32 gen; | |
244 | ||
245 | spin_lock(&lli->lli_layout_lock); | |
246 | gen = lli->lli_layout_gen; | |
247 | spin_unlock(&lli->lli_layout_lock); | |
248 | ||
249 | return gen; | |
250 | } | |
251 | ||
252 | static inline void ll_layout_version_set(struct ll_inode_info *lli, __u32 gen) | |
253 | { | |
254 | spin_lock(&lli->lli_layout_lock); | |
255 | lli->lli_layout_gen = gen; | |
256 | spin_unlock(&lli->lli_layout_lock); | |
257 | } | |
258 | ||
7fc1f831 AP |
259 | int ll_xattr_cache_destroy(struct inode *inode); |
260 | ||
e15ba45d OD |
261 | int ll_xattr_cache_get(struct inode *inode, const char *name, |
262 | char *buffer, size_t size, __u64 valid); | |
7fc1f831 | 263 | |
51cfb8c4 SB |
264 | int ll_init_security(struct dentry *dentry, struct inode *inode, |
265 | struct inode *dir); | |
266 | ||
d7e09d03 PT |
267 | /* |
268 | * Locking to guarantee consistency of non-atomic updates to long long i_size, | |
269 | * consistency between file size and KMS. | |
270 | * | |
47a57bde | 271 | * Implemented by ->lli_size_mutex and ->lsm_lock, nested in that order. |
d7e09d03 PT |
272 | */ |
273 | ||
274 | void ll_inode_size_lock(struct inode *inode); | |
275 | void ll_inode_size_unlock(struct inode *inode); | |
276 | ||
995c8b4a GD |
277 | /* FIXME: replace the name of this with LL_I to conform to kernel stuff */ |
278 | /* static inline struct ll_inode_info *LL_I(struct inode *inode) */ | |
d7e09d03 PT |
279 | static inline struct ll_inode_info *ll_i2info(struct inode *inode) |
280 | { | |
281 | return container_of(inode, struct ll_inode_info, lli_vfs_inode); | |
282 | } | |
283 | ||
198a49a9 JX |
284 | /* default to about 64M of readahead on a given system. */ |
285 | #define SBI_DEFAULT_READAHEAD_MAX (64UL << (20 - PAGE_SHIFT)) | |
d7e09d03 PT |
286 | |
287 | /* default to read-ahead full files smaller than 2MB on the second read */ | |
09cbfeaf | 288 | #define SBI_DEFAULT_READAHEAD_WHOLE_MAX (2UL << (20 - PAGE_SHIFT)) |
d7e09d03 PT |
289 | |
290 | enum ra_stat { | |
291 | RA_STAT_HIT = 0, | |
292 | RA_STAT_MISS, | |
293 | RA_STAT_DISTANT_READPAGE, | |
294 | RA_STAT_MISS_IN_WINDOW, | |
295 | RA_STAT_FAILED_GRAB_PAGE, | |
296 | RA_STAT_FAILED_MATCH, | |
297 | RA_STAT_DISCARDED, | |
298 | RA_STAT_ZERO_LEN, | |
299 | RA_STAT_ZERO_WINDOW, | |
300 | RA_STAT_EOF, | |
301 | RA_STAT_MAX_IN_FLIGHT, | |
302 | RA_STAT_WRONG_GRAB_PAGE, | |
fd7444fe | 303 | RA_STAT_FAILED_REACH_END, |
d7e09d03 PT |
304 | _NR_RA_STAT, |
305 | }; | |
306 | ||
307 | struct ll_ra_info { | |
308 | atomic_t ra_cur_pages; | |
309 | unsigned long ra_max_pages; | |
310 | unsigned long ra_max_pages_per_file; | |
311 | unsigned long ra_max_read_ahead_whole_pages; | |
312 | }; | |
313 | ||
314 | /* ra_io_arg will be filled in the beginning of ll_readahead with | |
315 | * ras_lock, then the following ll_read_ahead_pages will read RA | |
316 | * pages according to this arg, all the items in this structure are | |
317 | * counted by page index. | |
318 | */ | |
319 | struct ra_io_arg { | |
320 | unsigned long ria_start; /* start offset of read-ahead*/ | |
321 | unsigned long ria_end; /* end offset of read-ahead*/ | |
198a49a9 JX |
322 | unsigned long ria_reserved; /* reserved pages for read-ahead */ |
323 | unsigned long ria_end_min; /* minimum end to cover current read */ | |
324 | bool ria_eof; /* reach end of file */ | |
d7e09d03 PT |
325 | /* If stride read pattern is detected, ria_stoff means where |
326 | * stride read is started. Note: for normal read-ahead, the | |
c0894c6c OD |
327 | * value here is meaningless, and also it will not be accessed |
328 | */ | |
d7e09d03 PT |
329 | pgoff_t ria_stoff; |
330 | /* ria_length and ria_pages are the length and pages length in the | |
331 | * stride I/O mode. And they will also be used to check whether | |
c0894c6c OD |
332 | * it is stride I/O read-ahead in the read-ahead pages |
333 | */ | |
d7e09d03 PT |
334 | unsigned long ria_length; |
335 | unsigned long ria_pages; | |
336 | }; | |
337 | ||
338 | /* LL_HIST_MAX=32 causes an overflow */ | |
339 | #define LL_HIST_MAX 28 | |
340 | #define LL_HIST_START 12 /* buckets start at 2^12 = 4k */ | |
341 | #define LL_PROCESS_HIST_MAX 10 | |
342 | struct per_process_info { | |
343 | pid_t pid; | |
344 | struct obd_histogram pp_r_hist; | |
345 | struct obd_histogram pp_w_hist; | |
346 | }; | |
347 | ||
348 | /* pp_extents[LL_PROCESS_HIST_MAX] will hold the combined process info */ | |
349 | struct ll_rw_extents_info { | |
350 | struct per_process_info pp_extents[LL_PROCESS_HIST_MAX + 1]; | |
351 | }; | |
352 | ||
353 | #define LL_OFFSET_HIST_MAX 100 | |
354 | struct ll_rw_process_info { | |
355 | pid_t rw_pid; | |
356 | int rw_op; | |
357 | loff_t rw_range_start; | |
358 | loff_t rw_range_end; | |
359 | loff_t rw_last_file_pos; | |
360 | loff_t rw_offset; | |
361 | size_t rw_smallest_extent; | |
362 | size_t rw_largest_extent; | |
363 | struct ll_file_data *rw_last_file; | |
364 | }; | |
365 | ||
366 | enum stats_track_type { | |
367 | STATS_TRACK_ALL = 0, /* track all processes */ | |
368 | STATS_TRACK_PID, /* track process with this pid */ | |
369 | STATS_TRACK_PPID, /* track processes with this ppid */ | |
370 | STATS_TRACK_GID, /* track processes with this gid */ | |
371 | STATS_TRACK_LAST, | |
372 | }; | |
373 | ||
374 | /* flags for sbi->ll_flags */ | |
375 | #define LL_SBI_NOLCK 0x01 /* DLM locking disabled (directio-only) */ | |
376 | #define LL_SBI_CHECKSUM 0x02 /* checksum each page as it's written */ | |
377 | #define LL_SBI_FLOCK 0x04 | |
378 | #define LL_SBI_USER_XATTR 0x08 /* support user xattr */ | |
379 | #define LL_SBI_ACL 0x10 /* support ACL */ | |
341f1f0a | 380 | /* LL_SBI_RMT_CLIENT 0x40 remote client */ |
ef2e0f55 OD |
381 | #define LL_SBI_MDS_CAPA 0x80 /* support mds capa, obsolete */ |
382 | #define LL_SBI_OSS_CAPA 0x100 /* support oss capa, obsolete */ | |
d7e09d03 PT |
383 | #define LL_SBI_LOCALFLOCK 0x200 /* Local flocks support by kernel */ |
384 | #define LL_SBI_LRU_RESIZE 0x400 /* lru resize support */ | |
385 | #define LL_SBI_LAZYSTATFS 0x800 /* lazystatfs mount option */ | |
0cd99931 | 386 | /* LL_SBI_SOM_PREVIEW 0x1000 SOM preview mount option, obsolete */ |
d7e09d03 PT |
387 | #define LL_SBI_32BIT_API 0x2000 /* generate 32 bit inodes. */ |
388 | #define LL_SBI_64BIT_HASH 0x4000 /* support 64-bits dir hash/offset */ | |
389 | #define LL_SBI_AGL_ENABLED 0x8000 /* enable agl */ | |
390 | #define LL_SBI_VERBOSE 0x10000 /* verbose mount/umount */ | |
391 | #define LL_SBI_LAYOUT_LOCK 0x20000 /* layout lock support */ | |
392 | #define LL_SBI_USER_FID2PATH 0x40000 /* allow fid2path by unprivileged users */ | |
7fc1f831 | 393 | #define LL_SBI_XATTR_CACHE 0x80000 /* support for xattr cache */ |
c948390f | 394 | #define LL_SBI_NOROOTSQUASH 0x100000 /* do not apply root squash */ |
bfb9944c WW |
395 | #define LL_SBI_ALWAYS_PING 0x200000 /* always ping even if server |
396 | * suppress_pings */ | |
d7e09d03 PT |
397 | |
398 | #define LL_SBI_FLAGS { \ | |
399 | "nolck", \ | |
400 | "checksum", \ | |
401 | "flock", \ | |
816afc79 | 402 | "user_xattr", \ |
d7e09d03 | 403 | "acl", \ |
7fc1f831 | 404 | "???", \ |
341f1f0a | 405 | "???", \ |
d7e09d03 PT |
406 | "mds_capa", \ |
407 | "oss_capa", \ | |
408 | "flock", \ | |
409 | "lru_resize", \ | |
410 | "lazy_statfs", \ | |
411 | "som", \ | |
412 | "32bit_api", \ | |
413 | "64bit_hash", \ | |
414 | "agl", \ | |
415 | "verbose", \ | |
416 | "layout", \ | |
7fc1f831 | 417 | "user_fid2path",\ |
816afc79 | 418 | "xattr_cache", \ |
c948390f | 419 | "norootsquash", \ |
bfb9944c | 420 | "always_ping", \ |
7fc1f831 | 421 | } |
d7e09d03 | 422 | |
f9acb591 JH |
423 | /* |
424 | * This is embedded into llite super-blocks to keep track of connect | |
425 | * flags (capabilities) supported by all imports given mount is | |
426 | * connected to. | |
427 | */ | |
428 | struct lustre_client_ocd { | |
429 | /* | |
430 | * This is conjunction of connect_flags across all imports | |
431 | * (LOVs) this mount is connected to. This field is updated by | |
432 | * cl_ocd_update() under ->lco_lock. | |
433 | */ | |
434 | __u64 lco_flags; | |
435 | struct mutex lco_lock; | |
436 | struct obd_export *lco_md_exp; | |
437 | struct obd_export *lco_dt_exp; | |
438 | }; | |
439 | ||
d7e09d03 | 440 | struct ll_sb_info { |
d7e09d03 | 441 | /* this protects pglist and ra_info. It isn't safe to |
c0894c6c OD |
442 | * grab from interrupt contexts |
443 | */ | |
d7e09d03 PT |
444 | spinlock_t ll_lock; |
445 | spinlock_t ll_pp_extent_lock; /* pp_extent entry*/ | |
446 | spinlock_t ll_process_lock; /* ll_rw_process_info */ | |
447 | struct obd_uuid ll_sb_uuid; | |
448 | struct obd_export *ll_md_exp; | |
449 | struct obd_export *ll_dt_exp; | |
ae7c0f48 | 450 | struct dentry *ll_debugfs_entry; |
d7e09d03 PT |
451 | struct lu_fid ll_root_fid; /* root object fid */ |
452 | ||
453 | int ll_flags; | |
7fc1f831 | 454 | unsigned int ll_umounting:1, |
0cd99931 JH |
455 | ll_xattr_cache_enabled:1, |
456 | ll_client_common_fill_super_succeeded:1; | |
d7e09d03 | 457 | |
0cd99931 | 458 | struct lustre_client_ocd ll_lco; |
d7e09d03 PT |
459 | |
460 | struct lprocfs_stats *ll_stats; /* lprocfs stats counter */ | |
461 | ||
ac5b1481 PS |
462 | /* |
463 | * Used to track "unstable" pages on a client, and maintain a | |
464 | * LRU list of clean pages. An "unstable" page is defined as | |
465 | * any page which is sent to a server as part of a bulk request, | |
466 | * but is uncommitted to stable storage. | |
467 | */ | |
1b02bde3 | 468 | struct cl_client_cache *ll_cache; |
d7e09d03 PT |
469 | |
470 | struct lprocfs_stats *ll_ra_stats; | |
471 | ||
472 | struct ll_ra_info ll_ra_info; | |
473 | unsigned int ll_namelen; | |
474 | struct file_operations *ll_fop; | |
475 | ||
d8c0b0a9 | 476 | unsigned int ll_md_brw_pages; /* readdir pages per RPC */ |
d7e09d03 PT |
477 | |
478 | struct lu_site *ll_site; | |
479 | struct cl_device *ll_cl; | |
480 | /* Statistics */ | |
481 | struct ll_rw_extents_info ll_rw_extents_info; | |
482 | int ll_extent_process_count; | |
483 | struct ll_rw_process_info ll_rw_process_info[LL_PROCESS_HIST_MAX]; | |
484 | unsigned int ll_offset_process_count; | |
485 | struct ll_rw_process_info ll_rw_offset_info[LL_OFFSET_HIST_MAX]; | |
486 | unsigned int ll_rw_offset_entry_count; | |
487 | int ll_stats_track_id; | |
488 | enum stats_track_type ll_stats_track_type; | |
489 | int ll_rw_stats_on; | |
490 | ||
491 | /* metadata stat-ahead */ | |
492 | unsigned int ll_sa_max; /* max statahead RPCs */ | |
493 | atomic_t ll_sa_total; /* statahead thread started | |
c0894c6c OD |
494 | * count |
495 | */ | |
d7e09d03 | 496 | atomic_t ll_sa_wrong; /* statahead thread stopped for |
c0894c6c OD |
497 | * low hit ratio |
498 | */ | |
e9792be1 LS |
499 | atomic_t ll_sa_running; /* running statahead thread |
500 | * count | |
501 | */ | |
d7e09d03 PT |
502 | atomic_t ll_agl_total; /* AGL thread started count */ |
503 | ||
c0894c6c OD |
504 | dev_t ll_sdev_orig; /* save s_dev before assign for |
505 | * clustered nfs | |
506 | */ | |
c948390f GP |
507 | /* root squash */ |
508 | struct root_squash_info ll_squash; | |
3f4f7824 | 509 | struct path ll_mnt; |
c948390f | 510 | |
bd994071 | 511 | __kernel_fsid_t ll_fsid; |
fd0d04ba OD |
512 | struct kobject ll_kobj; /* sysfs object */ |
513 | struct super_block *ll_sb; /* struct super_block (for sysfs code)*/ | |
514 | struct completion ll_kobj_unregister; | |
d7e09d03 PT |
515 | }; |
516 | ||
d7e09d03 PT |
517 | /* |
518 | * per file-descriptor read-ahead data. | |
519 | */ | |
520 | struct ll_readahead_state { | |
521 | spinlock_t ras_lock; | |
522 | /* | |
523 | * index of the last page that read(2) needed and that wasn't in the | |
524 | * cache. Used by ras_update() to detect seeks. | |
525 | * | |
526 | * XXX nikita: if access seeks into cached region, Lustre doesn't see | |
527 | * this. | |
528 | */ | |
529 | unsigned long ras_last_readpage; | |
530 | /* | |
531 | * number of pages read after last read-ahead window reset. As window | |
532 | * is reset on each seek, this is effectively a number of consecutive | |
533 | * accesses. Maybe ->ras_accessed_in_window is better name. | |
534 | * | |
535 | * XXX nikita: window is also reset (by ras_update()) when Lustre | |
536 | * believes that memory pressure evicts read-ahead pages. In that | |
537 | * case, it probably doesn't make sense to expand window to | |
538 | * PTLRPC_MAX_BRW_PAGES on the third access. | |
539 | */ | |
540 | unsigned long ras_consecutive_pages; | |
541 | /* | |
542 | * number of read requests after the last read-ahead window reset | |
543 | * As window is reset on each seek, this is effectively the number | |
544 | * on consecutive read request and is used to trigger read-ahead. | |
545 | */ | |
546 | unsigned long ras_consecutive_requests; | |
547 | /* | |
548 | * Parameters of current read-ahead window. Handled by | |
549 | * ras_update(). On the initial access to the file or after a seek, | |
550 | * window is reset to 0. After 3 consecutive accesses, window is | |
551 | * expanded to PTLRPC_MAX_BRW_PAGES. Afterwards, window is enlarged by | |
552 | * PTLRPC_MAX_BRW_PAGES chunks up to ->ra_max_pages. | |
553 | */ | |
554 | unsigned long ras_window_start, ras_window_len; | |
198a49a9 JX |
555 | /* |
556 | * Optimal RPC size. It decides how many pages will be sent | |
557 | * for each read-ahead. | |
558 | */ | |
559 | unsigned long ras_rpc_size; | |
d7e09d03 PT |
560 | /* |
561 | * Where next read-ahead should start at. This lies within read-ahead | |
562 | * window. Read-ahead window is read in pieces rather than at once | |
563 | * because: 1. lustre limits total number of pages under read-ahead by | |
564 | * ->ra_max_pages (see ll_ra_count_get()), 2. client cannot read pages | |
565 | * not covered by DLM lock. | |
566 | */ | |
567 | unsigned long ras_next_readahead; | |
568 | /* | |
569 | * Total number of ll_file_read requests issued, reads originating | |
570 | * due to mmap are not counted in this total. This value is used to | |
571 | * trigger full file read-ahead after multiple reads to a small file. | |
572 | */ | |
573 | unsigned long ras_requests; | |
574 | /* | |
575 | * Page index with respect to the current request, these value | |
576 | * will not be accurate when dealing with reads issued via mmap. | |
577 | */ | |
578 | unsigned long ras_request_index; | |
d7e09d03 PT |
579 | /* |
580 | * The following 3 items are used for detecting the stride I/O | |
581 | * mode. | |
582 | * In stride I/O mode, | |
583 | * ...............|-----data-----|****gap*****|--------|******|.... | |
584 | * offset |-stride_pages-|-stride_gap-| | |
585 | * ras_stride_offset = offset; | |
586 | * ras_stride_length = stride_pages + stride_gap; | |
587 | * ras_stride_pages = stride_pages; | |
588 | * Note: all these three items are counted by pages. | |
589 | */ | |
590 | unsigned long ras_stride_length; | |
591 | unsigned long ras_stride_pages; | |
592 | pgoff_t ras_stride_offset; | |
593 | /* | |
594 | * number of consecutive stride request count, and it is similar as | |
595 | * ras_consecutive_requests, but used for stride I/O mode. | |
596 | * Note: only more than 2 consecutive stride request are detected, | |
597 | * stride read-ahead will be enable | |
598 | */ | |
599 | unsigned long ras_consecutive_stride_requests; | |
600 | }; | |
601 | ||
602 | extern struct kmem_cache *ll_file_data_slab; | |
603 | struct lustre_handle; | |
604 | struct ll_file_data { | |
605 | struct ll_readahead_state fd_ras; | |
98eae5e7 | 606 | struct ll_grouplock fd_grouplock; |
d7e09d03 PT |
607 | __u64 lfd_pos; |
608 | __u32 fd_flags; | |
d3a8a4e2 JX |
609 | fmode_t fd_omode; |
610 | /* openhandle if lease exists for this file. | |
c0894c6c OD |
611 | * Borrow lli->lli_och_mutex to protect assignment |
612 | */ | |
d3a8a4e2 JX |
613 | struct obd_client_handle *fd_lease_och; |
614 | struct obd_client_handle *fd_och; | |
d7e09d03 PT |
615 | struct file *fd_file; |
616 | /* Indicate whether need to report failure when close. | |
617 | * true: failure is known, not report again. | |
c0894c6c OD |
618 | * false: unknown failure, should report. |
619 | */ | |
d7e09d03 | 620 | bool fd_write_failed; |
966c4a8f JX |
621 | rwlock_t fd_lock; /* protect lcc list */ |
622 | struct list_head fd_lccs; /* list of ll_cl_context */ | |
d7e09d03 PT |
623 | }; |
624 | ||
ae7c0f48 | 625 | extern struct dentry *llite_root; |
fd0d04ba | 626 | extern struct kset *llite_kset; |
d7e09d03 PT |
627 | |
628 | static inline struct inode *ll_info2i(struct ll_inode_info *lli) | |
629 | { | |
630 | return &lli->lli_vfs_inode; | |
631 | } | |
632 | ||
d7e09d03 | 633 | __u32 ll_i2suppgid(struct inode *i); |
1d8cb70c | 634 | void ll_i2gids(__u32 *suppgids, struct inode *i1, struct inode *i2); |
d7e09d03 PT |
635 | |
636 | static inline int ll_need_32bit_api(struct ll_sb_info *sbi) | |
637 | { | |
638 | #if BITS_PER_LONG == 32 | |
639 | return 1; | |
2d95f10e | 640 | #elif defined(CONFIG_COMPAT) |
6d8bedff | 641 | return unlikely(in_compat_syscall() || (sbi->ll_flags & LL_SBI_32BIT_API)); |
d7e09d03 | 642 | #else |
2d95f10e | 643 | return unlikely(sbi->ll_flags & LL_SBI_32BIT_API); |
d7e09d03 PT |
644 | #endif |
645 | } | |
646 | ||
bc4320a9 | 647 | void ll_ras_enter(struct file *f); |
d7e09d03 | 648 | |
98eae5e7 | 649 | /* llite/lcommon_misc.c */ |
5c5af0fc JH |
650 | int cl_init_ea_size(struct obd_export *md_exp, struct obd_export *dt_exp); |
651 | int cl_ocd_update(struct obd_device *host, | |
652 | struct obd_device *watched, | |
653 | enum obd_notify_event ev, void *owner, void *data); | |
98eae5e7 JH |
654 | int cl_get_grouplock(struct cl_object *obj, unsigned long gid, int nonblock, |
655 | struct ll_grouplock *cg); | |
656 | void cl_put_grouplock(struct ll_grouplock *cg); | |
d7e09d03 PT |
657 | |
658 | /* llite/lproc_llite.c */ | |
ae7c0f48 OD |
659 | int ldebugfs_register_mountpoint(struct dentry *parent, |
660 | struct super_block *sb, char *osc, char *mdc); | |
661 | void ldebugfs_unregister_mountpoint(struct ll_sb_info *sbi); | |
d7e09d03 PT |
662 | void ll_stats_ops_tally(struct ll_sb_info *sbi, int op, int count); |
663 | void lprocfs_llite_init_vars(struct lprocfs_static_vars *lvars); | |
2c185ffa PT |
664 | void ll_rw_stats_tally(struct ll_sb_info *sbi, pid_t pid, |
665 | struct ll_file_data *file, loff_t pos, | |
666 | size_t count, int rw); | |
d7e09d03 | 667 | |
f9acb591 JH |
668 | enum { |
669 | LPROC_LL_DIRTY_HITS, | |
670 | LPROC_LL_DIRTY_MISSES, | |
671 | LPROC_LL_READ_BYTES, | |
672 | LPROC_LL_WRITE_BYTES, | |
673 | LPROC_LL_BRW_READ, | |
674 | LPROC_LL_BRW_WRITE, | |
f9acb591 JH |
675 | LPROC_LL_IOCTL, |
676 | LPROC_LL_OPEN, | |
677 | LPROC_LL_RELEASE, | |
678 | LPROC_LL_MAP, | |
679 | LPROC_LL_LLSEEK, | |
680 | LPROC_LL_FSYNC, | |
681 | LPROC_LL_READDIR, | |
682 | LPROC_LL_SETATTR, | |
683 | LPROC_LL_TRUNC, | |
684 | LPROC_LL_FLOCK, | |
685 | LPROC_LL_GETATTR, | |
686 | LPROC_LL_CREATE, | |
687 | LPROC_LL_LINK, | |
688 | LPROC_LL_UNLINK, | |
689 | LPROC_LL_SYMLINK, | |
690 | LPROC_LL_MKDIR, | |
691 | LPROC_LL_RMDIR, | |
692 | LPROC_LL_MKNOD, | |
693 | LPROC_LL_RENAME, | |
694 | LPROC_LL_STAFS, | |
695 | LPROC_LL_ALLOC_INODE, | |
696 | LPROC_LL_SETXATTR, | |
697 | LPROC_LL_GETXATTR, | |
698 | LPROC_LL_GETXATTR_HITS, | |
699 | LPROC_LL_LISTXATTR, | |
700 | LPROC_LL_REMOVEXATTR, | |
701 | LPROC_LL_INODE_PERM, | |
702 | LPROC_LL_FILE_OPCODES | |
703 | }; | |
704 | ||
d7e09d03 | 705 | /* llite/dir.c */ |
2d95f10e JH |
706 | extern const struct file_operations ll_dir_operations; |
707 | extern const struct inode_operations ll_dir_inode_operations; | |
218ba485 | 708 | int ll_dir_read(struct inode *inode, __u64 *ppos, struct md_op_data *op_data, |
307bef74 | 709 | struct dir_context *ctx); |
d7e09d03 | 710 | int ll_get_mdt_idx(struct inode *inode); |
79496845 | 711 | int ll_get_mdt_idx_by_fid(struct ll_sb_info *sbi, const struct lu_fid *fid); |
5b8d9852 | 712 | struct page *ll_get_dir_page(struct inode *dir, struct md_op_data *op_data, |
f9acb591 | 713 | __u64 offset); |
77a782ab | 714 | void ll_release_page(struct inode *inode, struct page *page, bool remove); |
5b8d9852 | 715 | |
d7e09d03 | 716 | /* llite/namei.c */ |
2d95f10e JH |
717 | extern const struct inode_operations ll_special_inode_operations; |
718 | ||
d7e09d03 PT |
719 | struct inode *ll_iget(struct super_block *sb, ino_t hash, |
720 | struct lustre_md *lic); | |
2de35386 | 721 | int ll_test_inode_by_fid(struct inode *inode, void *opaque); |
d7e09d03 PT |
722 | int ll_md_blocking_ast(struct ldlm_lock *, struct ldlm_lock_desc *, |
723 | void *data, int flag); | |
724 | struct dentry *ll_splice_alias(struct inode *inode, struct dentry *de); | |
79496845 | 725 | void ll_update_times(struct ptlrpc_request *request, struct inode *inode); |
d7e09d03 PT |
726 | |
727 | /* llite/rw.c */ | |
d7e09d03 PT |
728 | int ll_writepage(struct page *page, struct writeback_control *wbc); |
729 | int ll_writepages(struct address_space *, struct writeback_control *wbc); | |
d7e09d03 PT |
730 | int ll_readpage(struct file *file, struct page *page); |
731 | void ll_readahead_init(struct inode *inode, struct ll_readahead_state *ras); | |
1e1db2a9 | 732 | int vvp_io_write_commit(const struct lu_env *env, struct cl_io *io); |
966c4a8f JX |
733 | struct ll_cl_context *ll_cl_find(struct file *file); |
734 | void ll_cl_add(struct file *file, const struct lu_env *env, struct cl_io *io); | |
735 | void ll_cl_remove(struct file *file, const struct lu_env *env); | |
d7e09d03 | 736 | |
2d95f10e | 737 | extern const struct address_space_operations ll_aops; |
2d95f10e | 738 | |
d7e09d03 PT |
739 | /* llite/file.c */ |
740 | extern struct file_operations ll_file_operations; | |
741 | extern struct file_operations ll_file_operations_flock; | |
742 | extern struct file_operations ll_file_operations_noflock; | |
d2d32738 | 743 | extern const struct inode_operations ll_file_inode_operations; |
8150a97f | 744 | int ll_have_md_lock(struct inode *inode, __u64 *bits, |
52ee0d20 OD |
745 | enum ldlm_mode l_req_mode); |
746 | enum ldlm_mode ll_take_md_lock(struct inode *inode, __u64 bits, | |
747 | struct lustre_handle *lockh, __u64 flags, | |
748 | enum ldlm_mode mode); | |
d7e09d03 PT |
749 | int ll_file_open(struct inode *inode, struct file *file); |
750 | int ll_file_release(struct inode *inode, struct file *file); | |
e22fdcc8 | 751 | int ll_release_openhandle(struct inode *, struct lookup_intent *); |
45b2a010 | 752 | int ll_md_real_close(struct inode *inode, fmode_t fmode); |
a528d35e DH |
753 | int ll_getattr(const struct path *path, struct kstat *stat, |
754 | u32 request_mask, unsigned int flags); | |
2d95f10e | 755 | struct posix_acl *ll_get_acl(struct inode *inode, int type); |
79496845 | 756 | int ll_migrate(struct inode *parent, struct file *file, int mdtidx, |
757 | const char *name, int namelen); | |
1d82425f | 758 | int ll_get_fid_by_name(struct inode *parent, const char *name, |
f8e94638 | 759 | int namelen, struct lu_fid *fid, struct inode **inode); |
d7e09d03 PT |
760 | int ll_inode_permission(struct inode *inode, int mask); |
761 | ||
c139f3ce | 762 | int ll_lov_setstripe_ea_info(struct inode *inode, struct dentry *dentry, |
d467220e | 763 | __u64 flags, struct lov_user_md *lum, |
d7e09d03 PT |
764 | int lum_size); |
765 | int ll_lov_getstripe_ea_info(struct inode *inode, const char *filename, | |
766 | struct lov_mds_md **lmm, int *lmm_size, | |
767 | struct ptlrpc_request **request); | |
768 | int ll_dir_setstripe(struct inode *inode, struct lov_user_md *lump, | |
769 | int set_default); | |
6e23ea98 | 770 | int ll_dir_getstripe(struct inode *inode, void **lmmp, int *lmm_size, |
771 | struct ptlrpc_request **request, u64 valid); | |
d7e09d03 | 772 | int ll_fsync(struct file *file, loff_t start, loff_t end, int data); |
d2995737 | 773 | int ll_merge_attr(const struct lu_env *env, struct inode *inode); |
2b358b4e | 774 | int ll_fid2path(struct inode *inode, void __user *arg); |
e1798006 | 775 | int ll_data_version(struct inode *inode, __u64 *data_version, int flags); |
48d23e61 | 776 | int ll_hsm_release(struct inode *inode); |
1ed32aed | 777 | int ll_hsm_state_set(struct inode *inode, struct hsm_state_set *hss); |
d7e09d03 PT |
778 | |
779 | /* llite/dcache.c */ | |
780 | ||
2d95f10e | 781 | extern const struct dentry_operations ll_d_ops; |
d7e09d03 PT |
782 | void ll_intent_drop_lock(struct lookup_intent *); |
783 | void ll_intent_release(struct lookup_intent *); | |
784 | void ll_invalidate_aliases(struct inode *); | |
dbca51dd | 785 | void ll_lookup_finish_locks(struct lookup_intent *it, struct inode *inode); |
d7e09d03 | 786 | int ll_revalidate_it_finish(struct ptlrpc_request *request, |
dbca51dd | 787 | struct lookup_intent *it, struct inode *inode); |
d7e09d03 PT |
788 | |
789 | /* llite/llite_lib.c */ | |
790 | extern struct super_operations lustre_super_operations; | |
791 | ||
d7e09d03 PT |
792 | void ll_lli_init(struct ll_inode_info *lli); |
793 | int ll_fill_super(struct super_block *sb, struct vfsmount *mnt); | |
794 | void ll_put_super(struct super_block *sb); | |
795 | void ll_kill_super(struct super_block *sb); | |
796 | struct inode *ll_inode_from_resource_lock(struct ldlm_lock *lock); | |
a80ba5fe | 797 | void ll_dir_clear_lsm_md(struct inode *inode); |
d7e09d03 | 798 | void ll_clear_inode(struct inode *inode); |
a720b790 | 799 | int ll_setattr_raw(struct dentry *dentry, struct iattr *attr, bool hsm_import); |
d7e09d03 PT |
800 | int ll_setattr(struct dentry *de, struct iattr *attr); |
801 | int ll_statfs(struct dentry *de, struct kstatfs *sfs); | |
802 | int ll_statfs_internal(struct super_block *sb, struct obd_statfs *osfs, | |
803 | __u64 max_age, __u32 flags); | |
c3397e7e | 804 | int ll_update_inode(struct inode *inode, struct lustre_md *md); |
805 | int ll_read_inode2(struct inode *inode, void *opaque); | |
d7e09d03 PT |
806 | void ll_delete_inode(struct inode *inode); |
807 | int ll_iocontrol(struct inode *inode, struct file *file, | |
808 | unsigned int cmd, unsigned long arg); | |
809 | int ll_flush_ctx(struct inode *inode); | |
810 | void ll_umount_begin(struct super_block *sb); | |
811 | int ll_remount_fs(struct super_block *sb, int *flags, char *data); | |
812 | int ll_show_options(struct seq_file *seq, struct dentry *dentry); | |
813 | void ll_dirty_page_discard_warn(struct page *page, int ioret); | |
814 | int ll_prep_inode(struct inode **inode, struct ptlrpc_request *req, | |
815 | struct super_block *, struct lookup_intent *); | |
4c6243ec | 816 | int ll_obd_statfs(struct inode *inode, void __user *arg); |
d7e09d03 | 817 | int ll_get_max_mdsize(struct ll_sb_info *sbi, int *max_mdsize); |
44779340 | 818 | int ll_get_default_mdsize(struct ll_sb_info *sbi, int *default_mdsize); |
60b65afb | 819 | int ll_set_default_mdsize(struct ll_sb_info *sbi, int default_mdsize); |
d7e09d03 | 820 | int ll_process_config(struct lustre_cfg *lcfg); |
79496845 | 821 | |
822 | enum { | |
823 | LUSTRE_OPC_MKDIR = 0, | |
824 | LUSTRE_OPC_SYMLINK = 1, | |
825 | LUSTRE_OPC_MKNOD = 2, | |
826 | LUSTRE_OPC_CREATE = 3, | |
827 | LUSTRE_OPC_ANY = 5, | |
828 | }; | |
829 | ||
d7e09d03 PT |
830 | struct md_op_data *ll_prep_md_op_data(struct md_op_data *op_data, |
831 | struct inode *i1, struct inode *i2, | |
930f60e6 DE |
832 | const char *name, size_t namelen, |
833 | u32 mode, __u32 opc, void *data); | |
d7e09d03 PT |
834 | void ll_finish_md_op_data(struct md_op_data *op_data); |
835 | int ll_get_obd_name(struct inode *inode, unsigned int cmd, unsigned long arg); | |
836 | char *ll_get_fsname(struct super_block *sb, char *buf, int buflen); | |
c948390f | 837 | void ll_compute_rootsquash_state(struct ll_sb_info *sbi); |
44ecac68 | 838 | void ll_open_cleanup(struct super_block *sb, struct ptlrpc_request *open_req); |
dbf789ce JX |
839 | ssize_t ll_copy_user_md(const struct lov_user_md __user *md, |
840 | struct lov_user_md **kbuf); | |
841 | ||
842 | /* Compute expected user md size when passing in a md from user space */ | |
843 | static inline ssize_t ll_lov_user_md_size(const struct lov_user_md *lum) | |
844 | { | |
845 | switch (lum->lmm_magic) { | |
846 | case LOV_USER_MAGIC_V1: | |
847 | return sizeof(struct lov_user_md_v1); | |
848 | case LOV_USER_MAGIC_V3: | |
849 | return sizeof(struct lov_user_md_v3); | |
850 | case LOV_USER_MAGIC_SPECIFIC: | |
851 | if (lum->lmm_stripe_count > LOV_MAX_STRIPE_COUNT) | |
852 | return -EINVAL; | |
853 | ||
854 | return lov_user_md_size(lum->lmm_stripe_count, | |
855 | LOV_USER_MAGIC_SPECIFIC); | |
856 | } | |
857 | return -EINVAL; | |
858 | } | |
d7e09d03 PT |
859 | |
860 | /* llite/llite_nfs.c */ | |
98aa7661 | 861 | extern const struct export_operations lustre_export_operations; |
d7e09d03 | 862 | __u32 get_uuid2int(const char *name, int len); |
bd994071 | 863 | void get_uuid2fsid(const char *name, int len, __kernel_fsid_t *fsid); |
d7e09d03 PT |
864 | struct inode *search_inode_for_lustre(struct super_block *sb, |
865 | const struct lu_fid *fid); | |
ef21b1fb | 866 | int ll_dir_get_parent_fid(struct inode *dir, struct lu_fid *parent_fid); |
d7e09d03 | 867 | |
d7e09d03 | 868 | /* llite/symlink.c */ |
d2d32738 | 869 | extern const struct inode_operations ll_fast_symlink_inode_operations; |
d7e09d03 | 870 | |
d7e09d03 PT |
871 | /** |
872 | * IO arguments for various VFS I/O interfaces. | |
873 | */ | |
874 | struct vvp_io_args { | |
74c0da19 | 875 | /** normal/splice */ |
d7e09d03 PT |
876 | union { |
877 | struct { | |
878 | struct kiocb *via_iocb; | |
b42b15fd | 879 | struct iov_iter *via_iter; |
d7e09d03 | 880 | } normal; |
d7e09d03 PT |
881 | } u; |
882 | }; | |
883 | ||
884 | struct ll_cl_context { | |
966c4a8f | 885 | struct list_head lcc_list; |
d7e09d03 | 886 | void *lcc_cookie; |
966c4a8f | 887 | const struct lu_env *lcc_env; |
d7e09d03 PT |
888 | struct cl_io *lcc_io; |
889 | struct cl_page *lcc_page; | |
d7e09d03 PT |
890 | }; |
891 | ||
9989a58e JH |
892 | struct ll_thread_info { |
893 | struct vvp_io_args lti_args; | |
894 | struct ra_io_arg lti_ria; | |
895 | struct ll_cl_context lti_io_ctx; | |
d7e09d03 PT |
896 | }; |
897 | ||
9989a58e JH |
898 | extern struct lu_context_key ll_thread_key; |
899 | static inline struct ll_thread_info *ll_env_info(const struct lu_env *env) | |
d7e09d03 | 900 | { |
9989a58e | 901 | struct ll_thread_info *lti; |
d7e09d03 | 902 | |
9989a58e JH |
903 | lti = lu_context_key_get(&env->le_ctx, &ll_thread_key); |
904 | LASSERT(lti); | |
905 | return lti; | |
d7e09d03 PT |
906 | } |
907 | ||
82c156f8 | 908 | static inline struct vvp_io_args *ll_env_args(const struct lu_env *env) |
d7e09d03 | 909 | { |
82c156f8 | 910 | return &ll_env_info(env)->lti_args; |
d7e09d03 PT |
911 | } |
912 | ||
d7e09d03 | 913 | /* llite/llite_mmap.c */ |
d7e09d03 PT |
914 | |
915 | int ll_teardown_mmaps(struct address_space *mapping, __u64 first, __u64 last); | |
aff9d8e8 | 916 | int ll_file_mmap(struct file *file, struct vm_area_struct *vma); |
3dea3478 | 917 | void policy_from_vma(union ldlm_policy_data *policy, struct vm_area_struct *vma, |
e15ba45d | 918 | unsigned long addr, size_t count); |
d7e09d03 PT |
919 | struct vm_area_struct *our_vma(struct mm_struct *mm, unsigned long addr, |
920 | size_t count); | |
921 | ||
922 | static inline void ll_invalidate_page(struct page *vmpage) | |
923 | { | |
924 | struct address_space *mapping = vmpage->mapping; | |
09cbfeaf | 925 | loff_t offset = vmpage->index << PAGE_SHIFT; |
d7e09d03 PT |
926 | |
927 | LASSERT(PageLocked(vmpage)); | |
6e16818b | 928 | if (!mapping) |
d7e09d03 PT |
929 | return; |
930 | ||
7addf402 JX |
931 | /* |
932 | * truncate_complete_page() calls | |
933 | * a_ops->invalidatepage()->cl_page_delete()->vvp_page_delete(). | |
934 | */ | |
09cbfeaf | 935 | ll_teardown_mmaps(mapping, offset, offset + PAGE_SIZE); |
d7e09d03 PT |
936 | truncate_complete_page(mapping, vmpage); |
937 | } | |
938 | ||
939 | #define ll_s2sbi(sb) (s2lsi(sb)->lsi_llsbi) | |
940 | ||
941 | /* don't need an addref as the sb_info should be holding one */ | |
942 | static inline struct obd_export *ll_s2dtexp(struct super_block *sb) | |
943 | { | |
944 | return ll_s2sbi(sb)->ll_dt_exp; | |
945 | } | |
946 | ||
947 | /* don't need an addref as the sb_info should be holding one */ | |
948 | static inline struct obd_export *ll_s2mdexp(struct super_block *sb) | |
949 | { | |
950 | return ll_s2sbi(sb)->ll_md_exp; | |
951 | } | |
952 | ||
953 | static inline struct client_obd *sbi2mdc(struct ll_sb_info *sbi) | |
954 | { | |
955 | struct obd_device *obd = sbi->ll_md_exp->exp_obd; | |
50ffcb7e | 956 | |
6e16818b | 957 | if (!obd) |
d7e09d03 PT |
958 | LBUG(); |
959 | return &obd->u.cli; | |
960 | } | |
961 | ||
995c8b4a | 962 | /* FIXME: replace the name of this with LL_SB to conform to kernel stuff */ |
d7e09d03 PT |
963 | static inline struct ll_sb_info *ll_i2sbi(struct inode *inode) |
964 | { | |
965 | return ll_s2sbi(inode->i_sb); | |
966 | } | |
967 | ||
968 | static inline struct obd_export *ll_i2dtexp(struct inode *inode) | |
969 | { | |
970 | return ll_s2dtexp(inode->i_sb); | |
971 | } | |
972 | ||
973 | static inline struct obd_export *ll_i2mdexp(struct inode *inode) | |
974 | { | |
975 | return ll_s2mdexp(inode->i_sb); | |
976 | } | |
977 | ||
978 | static inline struct lu_fid *ll_inode2fid(struct inode *inode) | |
979 | { | |
980 | struct lu_fid *fid; | |
981 | ||
6e16818b | 982 | LASSERT(inode); |
d7e09d03 PT |
983 | fid = &ll_i2info(inode)->lli_fid; |
984 | ||
985 | return fid; | |
986 | } | |
987 | ||
090a6485 | 988 | static inline loff_t ll_file_maxbytes(struct inode *inode) |
d7e09d03 | 989 | { |
090a6485 JH |
990 | struct cl_object *obj = ll_i2info(inode)->lli_clob; |
991 | ||
992 | if (!obj) | |
993 | return MAX_LFS_FILESIZE; | |
994 | ||
995 | return min_t(loff_t, cl_object_maxbytes(obj), MAX_LFS_FILESIZE); | |
d7e09d03 PT |
996 | } |
997 | ||
998 | /* llite/xattr.c */ | |
2c563880 JS |
999 | extern const struct xattr_handler *ll_xattr_handlers[]; |
1000 | ||
a6d879fd HD |
1001 | #define XATTR_USER_T 1 |
1002 | #define XATTR_TRUSTED_T 2 | |
1003 | #define XATTR_SECURITY_T 3 | |
1004 | #define XATTR_ACL_ACCESS_T 4 | |
1005 | #define XATTR_ACL_DEFAULT_T 5 | |
1006 | #define XATTR_LUSTRE_T 6 | |
1007 | #define XATTR_OTHER_T 7 | |
1008 | ||
d7e09d03 | 1009 | ssize_t ll_listxattr(struct dentry *dentry, char *buffer, size_t size); |
a6d879fd HD |
1010 | int ll_xattr_list(struct inode *inode, const char *name, int type, |
1011 | void *buffer, size_t size, __u64 valid); | |
51cfb8c4 | 1012 | const struct xattr_handler *get_xattr_type(const char *name); |
d7e09d03 | 1013 | |
d7e09d03 PT |
1014 | /** |
1015 | * Common IO arguments for various VFS I/O interfaces. | |
1016 | */ | |
1017 | int cl_sb_init(struct super_block *sb); | |
1018 | int cl_sb_fini(struct super_block *sb); | |
d7e09d03 | 1019 | |
3c092fdb JX |
1020 | enum ras_update_flags { |
1021 | LL_RAS_HIT = 0x1, | |
1022 | LL_RAS_MMAP = 0x2 | |
1023 | }; | |
d7e09d03 | 1024 | void ll_ra_count_put(struct ll_sb_info *sbi, unsigned long len); |
fd7444fe | 1025 | void ll_ra_stats_inc(struct inode *inode, enum ra_stat which); |
d7e09d03 | 1026 | |
d7e09d03 | 1027 | /* statahead.c */ |
d7e09d03 PT |
1028 | #define LL_SA_RPC_MIN 2 |
1029 | #define LL_SA_RPC_DEF 32 | |
1030 | #define LL_SA_RPC_MAX 8192 | |
1031 | ||
1032 | #define LL_SA_CACHE_BIT 5 | |
1033 | #define LL_SA_CACHE_SIZE (1 << LL_SA_CACHE_BIT) | |
1034 | #define LL_SA_CACHE_MASK (LL_SA_CACHE_SIZE - 1) | |
1035 | ||
1036 | /* per inode struct, for dir only */ | |
1037 | struct ll_statahead_info { | |
5231f765 | 1038 | struct dentry *sai_dentry; |
d7e09d03 | 1039 | atomic_t sai_refcount; /* when access this struct, hold |
c0894c6c OD |
1040 | * refcount |
1041 | */ | |
d7e09d03 PT |
1042 | unsigned int sai_max; /* max ahead of lookup */ |
1043 | __u64 sai_sent; /* stat requests sent count */ | |
1044 | __u64 sai_replied; /* stat requests which received | |
c0894c6c OD |
1045 | * reply |
1046 | */ | |
d7e09d03 PT |
1047 | __u64 sai_index; /* index of statahead entry */ |
1048 | __u64 sai_index_wait; /* index of entry which is the | |
c0894c6c OD |
1049 | * caller is waiting for |
1050 | */ | |
d7e09d03 PT |
1051 | __u64 sai_hit; /* hit count */ |
1052 | __u64 sai_miss; /* miss count: | |
c0894c6c OD |
1053 | * for "ls -al" case, it includes |
1054 | * hidden dentry miss; | |
1055 | * for "ls -l" case, it does not | |
1056 | * include hidden dentry miss. | |
1057 | * "sai_miss_hidden" is used for | |
1058 | * the later case. | |
1059 | */ | |
d7e09d03 PT |
1060 | unsigned int sai_consecutive_miss; /* consecutive miss */ |
1061 | unsigned int sai_miss_hidden;/* "ls -al", but first dentry | |
c0894c6c OD |
1062 | * is not a hidden one |
1063 | */ | |
d7e09d03 PT |
1064 | unsigned int sai_skip_hidden;/* skipped hidden dentry count */ |
1065 | unsigned int sai_ls_all:1, /* "ls -al", do stat-ahead for | |
c0894c6c OD |
1066 | * hidden entries |
1067 | */ | |
2afad7fc | 1068 | sai_agl_valid:1,/* AGL is valid for the dir */ |
1069 | sai_in_readpage:1;/* statahead is in readdir() */ | |
c0894c6c | 1070 | wait_queue_head_t sai_waitq; /* stat-ahead wait queue */ |
d7e09d03 PT |
1071 | struct ptlrpc_thread sai_thread; /* stat-ahead thread */ |
1072 | struct ptlrpc_thread sai_agl_thread; /* AGL thread */ | |
e554fbff LS |
1073 | struct list_head sai_interim_entries; /* entries which got async |
1074 | * stat reply, but not | |
1075 | * instantiated | |
1076 | */ | |
1077 | struct list_head sai_entries; /* completed entries */ | |
1078 | struct list_head sai_agls; /* AGLs to be sent */ | |
c0894c6c | 1079 | struct list_head sai_cache[LL_SA_CACHE_SIZE]; |
d7e09d03 PT |
1080 | spinlock_t sai_cache_lock[LL_SA_CACHE_SIZE]; |
1081 | atomic_t sai_cache_count; /* entry count in cache */ | |
1082 | }; | |
1083 | ||
5231f765 | 1084 | int ll_statahead(struct inode *dir, struct dentry **dentry, bool unplug); |
e9792be1 LS |
1085 | void ll_authorize_statahead(struct inode *dir, void *key); |
1086 | void ll_deauthorize_statahead(struct inode *dir, void *key); | |
d7e09d03 | 1087 | |
5c5af0fc JH |
1088 | blkcnt_t dirty_cnt(struct inode *inode); |
1089 | ||
1090 | int cl_glimpse_size0(struct inode *inode, int agl); | |
1091 | int cl_glimpse_lock(const struct lu_env *env, struct cl_io *io, | |
1092 | struct inode *inode, struct cl_object *clob, int agl); | |
1093 | ||
1094 | static inline int cl_glimpse_size(struct inode *inode) | |
1095 | { | |
1096 | return cl_glimpse_size0(inode, 0); | |
1097 | } | |
1098 | ||
1099 | static inline int cl_agl(struct inode *inode) | |
1100 | { | |
1101 | return cl_glimpse_size0(inode, 1); | |
1102 | } | |
1103 | ||
d7e09d03 PT |
1104 | static inline int ll_glimpse_size(struct inode *inode) |
1105 | { | |
1106 | struct ll_inode_info *lli = ll_i2info(inode); | |
1107 | int rc; | |
1108 | ||
1109 | down_read(&lli->lli_glimpse_sem); | |
1110 | rc = cl_glimpse_size(inode); | |
1111 | lli->lli_glimpse_time = cfs_time_current(); | |
1112 | up_read(&lli->lli_glimpse_sem); | |
1113 | return rc; | |
1114 | } | |
1115 | ||
5231f765 LS |
1116 | /* |
1117 | * dentry may statahead when statahead is enabled and current process has opened | |
1118 | * parent directory, and this dentry hasn't accessed statahead cache before | |
1119 | */ | |
e9792be1 | 1120 | static inline bool |
5231f765 | 1121 | dentry_may_statahead(struct inode *dir, struct dentry *dentry) |
d7e09d03 PT |
1122 | { |
1123 | struct ll_inode_info *lli; | |
1124 | struct ll_dentry_data *ldd; | |
1125 | ||
1126 | if (ll_i2sbi(dir)->ll_sa_max == 0) | |
e9792be1 | 1127 | return false; |
d7e09d03 PT |
1128 | |
1129 | lli = ll_i2info(dir); | |
e9792be1 LS |
1130 | |
1131 | /* | |
1132 | * statahead is not allowed for this dir, there may be three causes: | |
1133 | * 1. dir is not opened. | |
1134 | * 2. statahead hit ratio is too low. | |
1135 | * 3. previous stat started statahead thread failed. | |
1136 | */ | |
1137 | if (!lli->lli_sa_enabled) | |
1138 | return false; | |
1139 | ||
d7e09d03 PT |
1140 | /* not the same process, don't statahead */ |
1141 | if (lli->lli_opendir_pid != current_pid()) | |
e9792be1 | 1142 | return false; |
d7e09d03 | 1143 | |
d7e09d03 | 1144 | /* |
5231f765 LS |
1145 | * When stating a dentry, kernel may trigger 'revalidate' or 'lookup' |
1146 | * multiple times, eg. for 'getattr', 'getxattr' and etc. | |
1147 | * For patchless client, lookup intent is not accurate, which may | |
1148 | * misguide statahead. For example: | |
1149 | * The 'revalidate' call for 'getattr' and 'getxattr' of a dentry will | |
1150 | * have the same intent -- IT_GETATTR, while one dentry should access | |
1151 | * statahead cache once, otherwise statahead windows is messed up. | |
d7e09d03 | 1152 | * The solution is as following: |
5231f765 LS |
1153 | * Assign 'lld_sa_generation' with 'lli_sa_generation' when a dentry |
1154 | * IT_GETATTR for the first time, and subsequent IT_GETATTR will | |
1155 | * bypass interacting with statahead cache by checking | |
1156 | * 'lld_sa_generation == lli->lli_sa_generation'. | |
d7e09d03 | 1157 | */ |
5231f765 | 1158 | ldd = ll_d2d(dentry); |
7126bc2e | 1159 | if (ldd->lld_sa_generation == lli->lli_sa_generation) |
e9792be1 | 1160 | return false; |
d7e09d03 | 1161 | |
e9792be1 | 1162 | return true; |
d7e09d03 PT |
1163 | } |
1164 | ||
d0a0acc3 | 1165 | /* llite ioctl register support routine */ |
d7e09d03 PT |
1166 | enum llioc_iter { |
1167 | LLIOC_CONT = 0, | |
1168 | LLIOC_STOP | |
1169 | }; | |
1170 | ||
1171 | #define LLIOC_MAX_CMD 256 | |
1172 | ||
1173 | /* | |
1174 | * Rules to write a callback function: | |
1175 | * | |
1176 | * Parameters: | |
d0a0acc3 | 1177 | * @magic: Dynamic ioctl call routine will feed this value with the pointer |
d7e09d03 PT |
1178 | * returned to ll_iocontrol_register. Callback functions should use this |
1179 | * data to check the potential collasion of ioctl cmd. If collasion is | |
1180 | * found, callback function should return LLIOC_CONT. | |
1181 | * @rcp: The result of ioctl command. | |
1182 | * | |
1183 | * Return values: | |
1184 | * If @magic matches the pointer returned by ll_iocontrol_data, the | |
1185 | * callback should return LLIOC_STOP; return LLIOC_STOP otherwise. | |
1186 | */ | |
1187 | typedef enum llioc_iter (*llioc_callback_t)(struct inode *inode, | |
1188 | struct file *file, unsigned int cmd, unsigned long arg, | |
1189 | void *magic, int *rcp); | |
1190 | ||
d7e09d03 PT |
1191 | /* export functions */ |
1192 | /* Register ioctl block dynamatically for a regular file. | |
1193 | * | |
1194 | * @cmd: the array of ioctl command set | |
1195 | * @count: number of commands in the @cmd | |
1196 | * @cb: callback function, it will be called if an ioctl command is found to | |
1197 | * belong to the command list @cmd. | |
1198 | * | |
d0a0acc3 | 1199 | * Return value: |
d7e09d03 PT |
1200 | * A magic pointer will be returned if success; |
1201 | * otherwise, NULL will be returned. | |
1202 | * */ | |
1203 | void *ll_iocontrol_register(llioc_callback_t cb, int count, unsigned int *cmd); | |
1204 | void ll_iocontrol_unregister(void *magic); | |
1205 | ||
d7e09d03 | 1206 | int cl_sync_file_range(struct inode *inode, loff_t start, loff_t end, |
65fb55d1 | 1207 | enum cl_fsync_mode mode, int ignore_layout); |
d7e09d03 PT |
1208 | |
1209 | /** direct write pages */ | |
1210 | struct ll_dio_pages { | |
1211 | /** page array to be written. we don't support | |
c0894c6c OD |
1212 | * partial pages except the last one. |
1213 | */ | |
d7e09d03 PT |
1214 | struct page **ldp_pages; |
1215 | /* offset of each page */ | |
1216 | loff_t *ldp_offsets; | |
1217 | /** if ldp_offsets is NULL, it means a sequential | |
1218 | * pages to be written, then this is the file offset | |
c0894c6c OD |
1219 | * of the first page. |
1220 | */ | |
d7e09d03 PT |
1221 | loff_t ldp_start_offset; |
1222 | /** how many bytes are to be written. */ | |
1223 | size_t ldp_size; | |
1224 | /** # of pages in the array. */ | |
1225 | int ldp_nr; | |
1226 | }; | |
1227 | ||
8150a97f JP |
1228 | ssize_t ll_direct_rw_pages(const struct lu_env *env, struct cl_io *io, |
1229 | int rw, struct inode *inode, | |
1230 | struct ll_dio_pages *pv); | |
d7e09d03 PT |
1231 | |
1232 | static inline int ll_file_nolock(const struct file *file) | |
1233 | { | |
1234 | struct ll_file_data *fd = LUSTRE_FPRIVATE(file); | |
2a8a3597 | 1235 | struct inode *inode = file_inode(file); |
d7e09d03 | 1236 | |
d7e09d03 PT |
1237 | return ((fd->fd_flags & LL_FILE_IGNORE_LOCK) || |
1238 | (ll_i2sbi(inode)->ll_flags & LL_SBI_NOLCK)); | |
1239 | } | |
1240 | ||
1241 | static inline void ll_set_lock_data(struct obd_export *exp, struct inode *inode, | |
1242 | struct lookup_intent *it, __u64 *bits) | |
1243 | { | |
e476f2e5 | 1244 | if (!it->it_lock_set) { |
d7e09d03 PT |
1245 | struct lustre_handle handle; |
1246 | ||
1247 | /* If this inode is a remote object, it will get two | |
1248 | * separate locks in different namespaces, Master MDT, | |
1249 | * where the name entry is, will grant LOOKUP lock, | |
1250 | * remote MDT, where the object is, will grant | |
d0a0acc3 | 1251 | * UPDATE|PERM lock. The inode will be attached to both |
d7e09d03 | 1252 | * LOOKUP and PERM locks, so revoking either locks will |
c0894c6c OD |
1253 | * case the dcache being cleared |
1254 | */ | |
e476f2e5 JH |
1255 | if (it->it_remote_lock_mode) { |
1256 | handle.cookie = it->it_remote_lock_handle; | |
97a075cd JN |
1257 | CDEBUG(D_DLMTRACE, "setting l_data to inode "DFID"%p for remote lock %#llx\n", |
1258 | PFID(ll_inode2fid(inode)), inode, | |
d7e09d03 | 1259 | handle.cookie); |
bc30c172 | 1260 | md_set_lock_data(exp, &handle, inode, NULL); |
d7e09d03 PT |
1261 | } |
1262 | ||
e476f2e5 | 1263 | handle.cookie = it->it_lock_handle; |
d7e09d03 | 1264 | |
97a075cd JN |
1265 | CDEBUG(D_DLMTRACE, "setting l_data to inode "DFID"%p for lock %#llx\n", |
1266 | PFID(ll_inode2fid(inode)), inode, handle.cookie); | |
d7e09d03 | 1267 | |
bc30c172 | 1268 | md_set_lock_data(exp, &handle, inode, &it->it_lock_bits); |
e476f2e5 | 1269 | it->it_lock_set = 1; |
d7e09d03 PT |
1270 | } |
1271 | ||
6e16818b | 1272 | if (bits) |
e476f2e5 | 1273 | *bits = it->it_lock_bits; |
d7e09d03 PT |
1274 | } |
1275 | ||
d7e09d03 PT |
1276 | static inline int d_lustre_invalid(const struct dentry *dentry) |
1277 | { | |
7126bc2e | 1278 | return ll_d2d(dentry)->lld_invalid; |
d7e09d03 PT |
1279 | } |
1280 | ||
1281 | /* | |
1282 | * Mark dentry INVALID, if dentry refcount is zero (this is normally case for | |
1283 | * ll_md_blocking_ast), unhash this dentry, and let dcache to reclaim it later; | |
1284 | * else dput() of the last refcount will unhash this dentry and kill it. | |
1285 | */ | |
b1d2a127 | 1286 | static inline void d_lustre_invalidate(struct dentry *dentry, int nested) |
d7e09d03 | 1287 | { |
dab363f9 LT |
1288 | CDEBUG(D_DENTRY, "invalidate dentry %pd (%p) parent %p inode %p refc %d\n", |
1289 | dentry, dentry, | |
2b0143b5 | 1290 | dentry->d_parent, d_inode(dentry), d_count(dentry)); |
d7e09d03 | 1291 | |
b1d2a127 PT |
1292 | spin_lock_nested(&dentry->d_lock, |
1293 | nested ? DENTRY_D_LOCK_NESTED : DENTRY_D_LOCK_NORMAL); | |
7126bc2e | 1294 | ll_d2d(dentry)->lld_invalid = 1; |
7f830d8d AP |
1295 | /* |
1296 | * We should be careful about dentries created by d_obtain_alias(). | |
1297 | * These dentries are not put in the dentry tree, instead they are | |
1298 | * linked to sb->s_anon through dentry->d_hash. | |
1299 | * shrink_dcache_for_umount() shrinks the tree and sb->s_anon list. | |
1300 | * If we unhashed such a dentry, unmount would not be able to find | |
1301 | * it and busy inodes would be reported. | |
1302 | */ | |
1303 | if (d_count(dentry) == 0 && !(dentry->d_flags & DCACHE_DISCONNECTED)) | |
d7e09d03 PT |
1304 | __d_drop(dentry); |
1305 | spin_unlock(&dentry->d_lock); | |
1306 | } | |
1307 | ||
1308 | static inline void d_lustre_revalidate(struct dentry *dentry) | |
1309 | { | |
1310 | spin_lock(&dentry->d_lock); | |
6e16818b | 1311 | LASSERT(ll_d2d(dentry)); |
d7e09d03 PT |
1312 | ll_d2d(dentry)->lld_invalid = 0; |
1313 | spin_unlock(&dentry->d_lock); | |
1314 | } | |
1315 | ||
d7e09d03 PT |
1316 | int ll_layout_conf(struct inode *inode, const struct cl_object_conf *conf); |
1317 | int ll_layout_refresh(struct inode *inode, __u32 *gen); | |
1b1594da | 1318 | int ll_layout_restore(struct inode *inode, loff_t start, __u64 length); |
d7e09d03 | 1319 | |
7fc1f831 AP |
1320 | int ll_xattr_init(void); |
1321 | void ll_xattr_fini(void); | |
1322 | ||
77605e41 JX |
1323 | int ll_page_sync_io(const struct lu_env *env, struct cl_io *io, |
1324 | struct cl_page *page, enum cl_req_type crt); | |
1325 | ||
a6d879fd HD |
1326 | int ll_getparent(struct file *file, struct getparent __user *arg); |
1327 | ||
a37bec74 | 1328 | /* lcommon_cl.c */ |
933eb397 JH |
1329 | int cl_setattr_ost(struct cl_object *obj, const struct iattr *attr, |
1330 | unsigned int attr_flags); | |
5c5af0fc | 1331 | |
a37bec74 JH |
1332 | extern struct lu_env *cl_inode_fini_env; |
1333 | extern int cl_inode_fini_refcheck; | |
1334 | ||
5c5af0fc JH |
1335 | int cl_file_inode_init(struct inode *inode, struct lustre_md *md); |
1336 | void cl_inode_fini(struct inode *inode); | |
5c5af0fc JH |
1337 | |
1338 | __u64 cl_fid_build_ino(const struct lu_fid *fid, int api32); | |
1339 | __u32 cl_fid_build_gen(const struct lu_fid *fid); | |
1340 | ||
d7e09d03 | 1341 | #endif /* LLITE_INTERNAL_H */ |