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