4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
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.
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).
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.gnu.org/licenses/gpl-2.0.html
23 * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
24 * Use is subject to license terms.
26 * Copyright (c) 2011, 2015, Intel Corporation.
29 * This file is part of Lustre, http://www.lustre.org/
30 * Lustre is a trademark of Sun Microsystems, Inc.
33 #ifndef LLITE_INTERNAL_H
34 #define LLITE_INTERNAL_H
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"
40 /* for struct cl_lock_descr and struct cl_io */
41 #include "../include/cl_object.h"
42 #include "../include/lustre_lmv.h"
43 #include "../include/lustre_mdc.h"
44 #include "../include/lustre_intent.h"
45 #include <linux/compat.h>
46 #include <linux/xattr.h>
47 #include <linux/posix_acl_xattr.h>
48 #include "vvp_internal.h"
54 #ifndef VM_FAULT_RETRY
55 #define VM_FAULT_RETRY 0
58 /** Only used on client-side for indicating the tail of dir hash/offset. */
59 #define LL_DIR_END_OFF 0x7fffffffffffffffULL
60 #define LL_DIR_END_OFF_32BIT 0x7fffffffUL
62 #define LL_IT2STR(it) ((it) ? ldlm_it2str((it)->it_op) : "0")
63 #define LUSTRE_FPRIVATE(file) ((file)->private_data)
65 struct ll_dentry_data
{
66 struct lookup_intent
*lld_it
;
67 unsigned int lld_sa_generation
;
68 unsigned int lld_invalid
:1;
69 unsigned int lld_nfs_dentry
:1;
70 struct rcu_head lld_rcu_head
;
73 #define ll_d2d(de) ((struct ll_dentry_data *)((de)->d_fsdata))
75 #define LLI_INODE_MAGIC 0x111d0de5
76 #define LLI_INODE_DEAD 0xdeadd00d
78 struct ll_getname_data
{
79 struct dir_context ctx
;
80 char *lgd_name
; /* points to a buffer with NAME_MAX+1 size */
81 struct lu_fid lgd_fid
; /* target fid we are looking for */
82 int lgd_found
; /* inode matched? */
86 struct lu_env
*lg_env
;
88 struct cl_lock
*lg_lock
;
93 /* MDS has an authority for the Size-on-MDS attributes. */
94 LLIF_MDS_SIZE_LOCK
= (1 << 0),
95 /* Epoch close is postponed. */
96 LLIF_EPOCH_PENDING
= (1 << 1),
97 /* DONE WRITING is allowed. */
98 LLIF_DONE_WRITING
= (1 << 2),
99 /* Sizeon-on-MDS attributes are changed. An attribute update needs to
102 LLIF_SOM_DIRTY
= (1 << 3),
103 /* File data is modified. */
104 LLIF_DATA_MODIFIED
= (1 << 4),
105 /* File is being restored */
106 LLIF_FILE_RESTORING
= (1 << 5),
107 /* Xattr cache is attached to the file */
108 LLIF_XATTR_CACHE
= (1 << 6),
111 struct ll_inode_info
{
112 __u32 lli_inode_magic
;
117 struct posix_acl
*lli_posix_acl
;
119 /* identifying fields for both metadata and data stacks. */
120 struct lu_fid lli_fid
;
121 /* master inode fid for stripe directory */
122 struct lu_fid lli_pfid
;
124 struct list_head lli_close_list
;
126 /* handle is to be sent to MDS later on done_writing and setattr.
127 * Open handle data are needed for the recovery to reconstruct
128 * the inode state on the MDS. XXX: recovery is not ready yet.
130 struct obd_client_handle
*lli_pending_och
;
132 /* We need all three because every inode may be opened in different
135 struct obd_client_handle
*lli_mds_read_och
;
136 struct obd_client_handle
*lli_mds_write_och
;
137 struct obd_client_handle
*lli_mds_exec_och
;
138 __u64 lli_open_fd_read_count
;
139 __u64 lli_open_fd_write_count
;
140 __u64 lli_open_fd_exec_count
;
141 /* Protects access to och pointers and their usage counters */
142 struct mutex lli_och_mutex
;
144 struct inode lli_vfs_inode
;
146 /* the most recent timestamps obtained from mds */
150 spinlock_t lli_agl_lock
;
152 /* Try to make the d::member and f::member are aligned. Before using
153 * these members, make clear whether it is directory or not.
158 /* serialize normal readdir and statahead-readdir. */
159 struct mutex d_readdir_mutex
;
161 /* metadata statahead */
162 /* since parent-child threads can share the same @file
163 * struct, "opendir_key" is the token when dir close for
164 * case of parent exit before child -- it is me should
165 * cleanup the dir readahead.
168 struct ll_statahead_info
*d_sai
;
169 /* protect statahead stuff. */
170 spinlock_t d_sa_lock
;
171 /* "opendir_pid" is the token when lookup/revalidate
172 * -- I am the owner of dir statahead.
175 /* directory stripe information */
176 struct lmv_stripe_md
*d_lsm_md
;
177 /* striped directory size */
178 loff_t d_stripe_size
;
179 /* striped directory nlink */
180 __u64 d_stripe_nlink
;
183 #define lli_readdir_mutex u.d.d_readdir_mutex
184 #define lli_opendir_key u.d.d_opendir_key
185 #define lli_sai u.d.d_sai
186 #define lli_sa_lock u.d.d_sa_lock
187 #define lli_opendir_pid u.d.d_opendir_pid
188 #define lli_lsm_md u.d.d_lsm_md
189 #define lli_stripe_dir_size u.d.d_stripe_size
190 #define lli_stripe_dir_nlink u.d.d_stripe_nlink
192 /* for non-directory */
194 struct mutex f_size_mutex
;
195 char *f_symlink_name
;
198 * struct rw_semaphore {
199 * signed long count; // align d.d_def_acl
200 * spinlock_t wait_lock; // align d.d_sa_lock
201 * struct list_head wait_list;
204 struct rw_semaphore f_trunc_sem
;
205 struct mutex f_write_mutex
;
207 struct rw_semaphore f_glimpse_sem
;
208 unsigned long f_glimpse_time
;
209 struct list_head f_agl_list
;
212 /* for writepage() only to communicate to fsync */
216 * whenever a process try to read/write the file, the
217 * jobid of the process will be saved here, and it'll
218 * be packed into the write PRC when flush later.
220 * so the read/write statistics for jobid will not be
221 * accurate if the file is shared by different jobs.
223 char f_jobid
[JOBSTATS_JOBID_SIZE
];
226 #define lli_size_mutex u.f.f_size_mutex
227 #define lli_symlink_name u.f.f_symlink_name
228 #define lli_maxbytes u.f.f_maxbytes
229 #define lli_trunc_sem u.f.f_trunc_sem
230 #define lli_write_mutex u.f.f_write_mutex
231 #define lli_glimpse_sem u.f.f_glimpse_sem
232 #define lli_glimpse_time u.f.f_glimpse_time
233 #define lli_agl_list u.f.f_agl_list
234 #define lli_agl_index u.f.f_agl_index
235 #define lli_async_rc u.f.f_async_rc
236 #define lli_jobid u.f.f_jobid
240 /* XXX: For following frequent used members, although they maybe special
241 * used for non-directory object, it is some time-wasting to check
242 * whether the object is directory or not before using them. On the
243 * other hand, currently, sizeof(f) > sizeof(d), it cannot reduce
244 * the "ll_inode_info" size even if moving those members into u.f.
245 * So keep them out side.
247 * In the future, if more members are added only for directory,
248 * some of the following members can be moved into u.f.
251 struct cl_object
*lli_clob
;
253 /* mutex to request for layout lock exclusively. */
254 struct mutex lli_layout_mutex
;
255 /* Layout version, protected by lli_layout_lock */
256 __u32 lli_layout_gen
;
257 spinlock_t lli_layout_lock
;
259 struct rw_semaphore lli_xattrs_list_rwsem
;
260 struct mutex lli_xattrs_enq_lock
;
261 struct list_head lli_xattrs
;/* ll_xattr_entry->xe_list */
264 static inline __u32
ll_layout_version_get(struct ll_inode_info
*lli
)
268 spin_lock(&lli
->lli_layout_lock
);
269 gen
= lli
->lli_layout_gen
;
270 spin_unlock(&lli
->lli_layout_lock
);
275 static inline void ll_layout_version_set(struct ll_inode_info
*lli
, __u32 gen
)
277 spin_lock(&lli
->lli_layout_lock
);
278 lli
->lli_layout_gen
= gen
;
279 spin_unlock(&lli
->lli_layout_lock
);
282 int ll_xattr_cache_destroy(struct inode
*inode
);
284 int ll_xattr_cache_get(struct inode
*inode
, const char *name
,
285 char *buffer
, size_t size
, __u64 valid
);
288 * Locking to guarantee consistency of non-atomic updates to long long i_size,
289 * consistency between file size and KMS.
291 * Implemented by ->lli_size_mutex and ->lsm_lock, nested in that order.
294 void ll_inode_size_lock(struct inode
*inode
);
295 void ll_inode_size_unlock(struct inode
*inode
);
297 /* FIXME: replace the name of this with LL_I to conform to kernel stuff */
298 /* static inline struct ll_inode_info *LL_I(struct inode *inode) */
299 static inline struct ll_inode_info
*ll_i2info(struct inode
*inode
)
301 return container_of(inode
, struct ll_inode_info
, lli_vfs_inode
);
304 /* default to about 40meg of readahead on a given system. That much tied
305 * up in 512k readahead requests serviced at 40ms each is about 1GB/s.
307 #define SBI_DEFAULT_READAHEAD_MAX (40UL << (20 - PAGE_SHIFT))
309 /* default to read-ahead full files smaller than 2MB on the second read */
310 #define SBI_DEFAULT_READAHEAD_WHOLE_MAX (2UL << (20 - PAGE_SHIFT))
315 RA_STAT_DISTANT_READPAGE
,
316 RA_STAT_MISS_IN_WINDOW
,
317 RA_STAT_FAILED_GRAB_PAGE
,
318 RA_STAT_FAILED_MATCH
,
323 RA_STAT_MAX_IN_FLIGHT
,
324 RA_STAT_WRONG_GRAB_PAGE
,
325 RA_STAT_FAILED_REACH_END
,
330 atomic_t ra_cur_pages
;
331 unsigned long ra_max_pages
;
332 unsigned long ra_max_pages_per_file
;
333 unsigned long ra_max_read_ahead_whole_pages
;
336 /* ra_io_arg will be filled in the beginning of ll_readahead with
337 * ras_lock, then the following ll_read_ahead_pages will read RA
338 * pages according to this arg, all the items in this structure are
339 * counted by page index.
342 unsigned long ria_start
; /* start offset of read-ahead*/
343 unsigned long ria_end
; /* end offset of read-ahead*/
344 /* If stride read pattern is detected, ria_stoff means where
345 * stride read is started. Note: for normal read-ahead, the
346 * value here is meaningless, and also it will not be accessed
349 /* ria_length and ria_pages are the length and pages length in the
350 * stride I/O mode. And they will also be used to check whether
351 * it is stride I/O read-ahead in the read-ahead pages
353 unsigned long ria_length
;
354 unsigned long ria_pages
;
357 /* LL_HIST_MAX=32 causes an overflow */
358 #define LL_HIST_MAX 28
359 #define LL_HIST_START 12 /* buckets start at 2^12 = 4k */
360 #define LL_PROCESS_HIST_MAX 10
361 struct per_process_info
{
363 struct obd_histogram pp_r_hist
;
364 struct obd_histogram pp_w_hist
;
367 /* pp_extents[LL_PROCESS_HIST_MAX] will hold the combined process info */
368 struct ll_rw_extents_info
{
369 struct per_process_info pp_extents
[LL_PROCESS_HIST_MAX
+ 1];
372 #define LL_OFFSET_HIST_MAX 100
373 struct ll_rw_process_info
{
376 loff_t rw_range_start
;
378 loff_t rw_last_file_pos
;
380 size_t rw_smallest_extent
;
381 size_t rw_largest_extent
;
382 struct ll_file_data
*rw_last_file
;
385 enum stats_track_type
{
386 STATS_TRACK_ALL
= 0, /* track all processes */
387 STATS_TRACK_PID
, /* track process with this pid */
388 STATS_TRACK_PPID
, /* track processes with this ppid */
389 STATS_TRACK_GID
, /* track processes with this gid */
393 /* flags for sbi->ll_flags */
394 #define LL_SBI_NOLCK 0x01 /* DLM locking disabled (directio-only) */
395 #define LL_SBI_CHECKSUM 0x02 /* checksum each page as it's written */
396 #define LL_SBI_FLOCK 0x04
397 #define LL_SBI_USER_XATTR 0x08 /* support user xattr */
398 #define LL_SBI_ACL 0x10 /* support ACL */
399 /* LL_SBI_RMT_CLIENT 0x40 remote client */
400 #define LL_SBI_MDS_CAPA 0x80 /* support mds capa, obsolete */
401 #define LL_SBI_OSS_CAPA 0x100 /* support oss capa, obsolete */
402 #define LL_SBI_LOCALFLOCK 0x200 /* Local flocks support by kernel */
403 #define LL_SBI_LRU_RESIZE 0x400 /* lru resize support */
404 #define LL_SBI_LAZYSTATFS 0x800 /* lazystatfs mount option */
405 #define LL_SBI_SOM_PREVIEW 0x1000 /* SOM preview mount option */
406 #define LL_SBI_32BIT_API 0x2000 /* generate 32 bit inodes. */
407 #define LL_SBI_64BIT_HASH 0x4000 /* support 64-bits dir hash/offset */
408 #define LL_SBI_AGL_ENABLED 0x8000 /* enable agl */
409 #define LL_SBI_VERBOSE 0x10000 /* verbose mount/umount */
410 #define LL_SBI_LAYOUT_LOCK 0x20000 /* layout lock support */
411 #define LL_SBI_USER_FID2PATH 0x40000 /* allow fid2path by unprivileged users */
412 #define LL_SBI_XATTR_CACHE 0x80000 /* support for xattr cache */
413 #define LL_SBI_NOROOTSQUASH 0x100000 /* do not apply root squash */
415 #define LL_SBI_FLAGS { \
440 /* this protects pglist and ra_info. It isn't safe to
441 * grab from interrupt contexts
444 spinlock_t ll_pp_extent_lock
; /* pp_extent entry*/
445 spinlock_t ll_process_lock
; /* ll_rw_process_info */
446 struct obd_uuid ll_sb_uuid
;
447 struct obd_export
*ll_md_exp
;
448 struct obd_export
*ll_dt_exp
;
449 struct dentry
*ll_debugfs_entry
;
450 struct lu_fid ll_root_fid
; /* root object fid */
453 unsigned int ll_umounting
:1,
454 ll_xattr_cache_enabled
:1;
455 struct lustre_client_ocd ll_lco
;
457 struct ll_close_queue
*ll_lcq
;
459 struct lprocfs_stats
*ll_stats
; /* lprocfs stats counter */
462 * Used to track "unstable" pages on a client, and maintain a
463 * LRU list of clean pages. An "unstable" page is defined as
464 * any page which is sent to a server as part of a bulk request,
465 * but is uncommitted to stable storage.
467 struct cl_client_cache
*ll_cache
;
469 struct lprocfs_stats
*ll_ra_stats
;
471 struct ll_ra_info ll_ra_info
;
472 unsigned int ll_namelen
;
473 struct file_operations
*ll_fop
;
475 unsigned int ll_md_brw_pages
; /* readdir pages per RPC */
477 struct lu_site
*ll_site
;
478 struct cl_device
*ll_cl
;
480 struct ll_rw_extents_info ll_rw_extents_info
;
481 int ll_extent_process_count
;
482 struct ll_rw_process_info ll_rw_process_info
[LL_PROCESS_HIST_MAX
];
483 unsigned int ll_offset_process_count
;
484 struct ll_rw_process_info ll_rw_offset_info
[LL_OFFSET_HIST_MAX
];
485 unsigned int ll_rw_offset_entry_count
;
486 int ll_stats_track_id
;
487 enum stats_track_type ll_stats_track_type
;
490 /* metadata stat-ahead */
491 unsigned int ll_sa_max
; /* max statahead RPCs */
492 atomic_t ll_sa_total
; /* statahead thread started
495 atomic_t ll_sa_wrong
; /* statahead thread stopped for
498 atomic_t ll_agl_total
; /* AGL thread started count */
500 dev_t ll_sdev_orig
; /* save s_dev before assign for
504 struct root_squash_info ll_squash
;
506 __kernel_fsid_t ll_fsid
;
507 struct kobject ll_kobj
; /* sysfs object */
508 struct super_block
*ll_sb
; /* struct super_block (for sysfs code)*/
509 struct completion ll_kobj_unregister
;
513 * per file-descriptor read-ahead data.
515 struct ll_readahead_state
{
518 * index of the last page that read(2) needed and that wasn't in the
519 * cache. Used by ras_update() to detect seeks.
521 * XXX nikita: if access seeks into cached region, Lustre doesn't see
524 unsigned long ras_last_readpage
;
526 * number of pages read after last read-ahead window reset. As window
527 * is reset on each seek, this is effectively a number of consecutive
528 * accesses. Maybe ->ras_accessed_in_window is better name.
530 * XXX nikita: window is also reset (by ras_update()) when Lustre
531 * believes that memory pressure evicts read-ahead pages. In that
532 * case, it probably doesn't make sense to expand window to
533 * PTLRPC_MAX_BRW_PAGES on the third access.
535 unsigned long ras_consecutive_pages
;
537 * number of read requests after the last read-ahead window reset
538 * As window is reset on each seek, this is effectively the number
539 * on consecutive read request and is used to trigger read-ahead.
541 unsigned long ras_consecutive_requests
;
543 * Parameters of current read-ahead window. Handled by
544 * ras_update(). On the initial access to the file or after a seek,
545 * window is reset to 0. After 3 consecutive accesses, window is
546 * expanded to PTLRPC_MAX_BRW_PAGES. Afterwards, window is enlarged by
547 * PTLRPC_MAX_BRW_PAGES chunks up to ->ra_max_pages.
549 unsigned long ras_window_start
, ras_window_len
;
551 * Where next read-ahead should start at. This lies within read-ahead
552 * window. Read-ahead window is read in pieces rather than at once
553 * because: 1. lustre limits total number of pages under read-ahead by
554 * ->ra_max_pages (see ll_ra_count_get()), 2. client cannot read pages
555 * not covered by DLM lock.
557 unsigned long ras_next_readahead
;
559 * Total number of ll_file_read requests issued, reads originating
560 * due to mmap are not counted in this total. This value is used to
561 * trigger full file read-ahead after multiple reads to a small file.
563 unsigned long ras_requests
;
565 * Page index with respect to the current request, these value
566 * will not be accurate when dealing with reads issued via mmap.
568 unsigned long ras_request_index
;
570 * The following 3 items are used for detecting the stride I/O
572 * In stride I/O mode,
573 * ...............|-----data-----|****gap*****|--------|******|....
574 * offset |-stride_pages-|-stride_gap-|
575 * ras_stride_offset = offset;
576 * ras_stride_length = stride_pages + stride_gap;
577 * ras_stride_pages = stride_pages;
578 * Note: all these three items are counted by pages.
580 unsigned long ras_stride_length
;
581 unsigned long ras_stride_pages
;
582 pgoff_t ras_stride_offset
;
584 * number of consecutive stride request count, and it is similar as
585 * ras_consecutive_requests, but used for stride I/O mode.
586 * Note: only more than 2 consecutive stride request are detected,
587 * stride read-ahead will be enable
589 unsigned long ras_consecutive_stride_requests
;
592 extern struct kmem_cache
*ll_file_data_slab
;
593 struct lustre_handle
;
594 struct ll_file_data
{
595 struct ll_readahead_state fd_ras
;
596 struct ll_grouplock fd_grouplock
;
600 /* openhandle if lease exists for this file.
601 * Borrow lli->lli_och_mutex to protect assignment
603 struct obd_client_handle
*fd_lease_och
;
604 struct obd_client_handle
*fd_och
;
605 struct file
*fd_file
;
606 /* Indicate whether need to report failure when close.
607 * true: failure is known, not report again.
608 * false: unknown failure, should report.
610 bool fd_write_failed
;
611 rwlock_t fd_lock
; /* protect lcc list */
612 struct list_head fd_lccs
; /* list of ll_cl_context */
615 struct lov_stripe_md
;
617 extern struct dentry
*llite_root
;
618 extern struct kset
*llite_kset
;
620 static inline struct inode
*ll_info2i(struct ll_inode_info
*lli
)
622 return &lli
->lli_vfs_inode
;
625 __u32
ll_i2suppgid(struct inode
*i
);
626 void ll_i2gids(__u32
*suppgids
, struct inode
*i1
, struct inode
*i2
);
628 static inline int ll_need_32bit_api(struct ll_sb_info
*sbi
)
630 #if BITS_PER_LONG == 32
632 #elif defined(CONFIG_COMPAT)
633 return unlikely(in_compat_syscall() || (sbi
->ll_flags
& LL_SBI_32BIT_API
));
635 return unlikely(sbi
->ll_flags
& LL_SBI_32BIT_API
);
639 void ll_ras_enter(struct file
*f
);
641 /* llite/lcommon_misc.c */
642 int cl_init_ea_size(struct obd_export
*md_exp
, struct obd_export
*dt_exp
);
643 int cl_ocd_update(struct obd_device
*host
,
644 struct obd_device
*watched
,
645 enum obd_notify_event ev
, void *owner
, void *data
);
646 int cl_get_grouplock(struct cl_object
*obj
, unsigned long gid
, int nonblock
,
647 struct ll_grouplock
*cg
);
648 void cl_put_grouplock(struct ll_grouplock
*cg
);
650 /* llite/lproc_llite.c */
651 int ldebugfs_register_mountpoint(struct dentry
*parent
,
652 struct super_block
*sb
, char *osc
, char *mdc
);
653 void ldebugfs_unregister_mountpoint(struct ll_sb_info
*sbi
);
654 void ll_stats_ops_tally(struct ll_sb_info
*sbi
, int op
, int count
);
655 void lprocfs_llite_init_vars(struct lprocfs_static_vars
*lvars
);
656 void ll_rw_stats_tally(struct ll_sb_info
*sbi
, pid_t pid
,
657 struct ll_file_data
*file
, loff_t pos
,
658 size_t count
, int rw
);
661 extern const struct file_operations ll_dir_operations
;
662 extern const struct inode_operations ll_dir_inode_operations
;
663 int ll_dir_read(struct inode
*inode
, __u64
*ppos
, struct md_op_data
*op_data
,
664 struct dir_context
*ctx
);
665 int ll_get_mdt_idx(struct inode
*inode
);
666 int ll_get_mdt_idx_by_fid(struct ll_sb_info
*sbi
, const struct lu_fid
*fid
);
667 struct page
*ll_get_dir_page(struct inode
*dir
, struct md_op_data
*op_data
,
668 __u64 offset
, struct ll_dir_chain
*chain
);
669 void ll_release_page(struct inode
*inode
, struct page
*page
, bool remove
);
672 extern const struct inode_operations ll_special_inode_operations
;
674 int ll_objects_destroy(struct ptlrpc_request
*request
,
676 struct inode
*ll_iget(struct super_block
*sb
, ino_t hash
,
677 struct lustre_md
*lic
);
678 int ll_test_inode_by_fid(struct inode
*inode
, void *opaque
);
679 int ll_md_blocking_ast(struct ldlm_lock
*, struct ldlm_lock_desc
*,
680 void *data
, int flag
);
681 struct dentry
*ll_splice_alias(struct inode
*inode
, struct dentry
*de
);
682 void ll_update_times(struct ptlrpc_request
*request
, struct inode
*inode
);
685 int ll_writepage(struct page
*page
, struct writeback_control
*wbc
);
686 int ll_writepages(struct address_space
*, struct writeback_control
*wbc
);
687 int ll_readpage(struct file
*file
, struct page
*page
);
688 void ll_readahead_init(struct inode
*inode
, struct ll_readahead_state
*ras
);
689 int ll_readahead(const struct lu_env
*env
, struct cl_io
*io
,
690 struct cl_page_list
*queue
, struct ll_readahead_state
*ras
,
692 struct ll_cl_context
*ll_cl_find(struct file
*file
);
693 void ll_cl_add(struct file
*file
, const struct lu_env
*env
, struct cl_io
*io
);
694 void ll_cl_remove(struct file
*file
, const struct lu_env
*env
);
696 extern const struct address_space_operations ll_aops
;
699 extern struct file_operations ll_file_operations
;
700 extern struct file_operations ll_file_operations_flock
;
701 extern struct file_operations ll_file_operations_noflock
;
702 extern const struct inode_operations ll_file_inode_operations
;
703 int ll_have_md_lock(struct inode
*inode
, __u64
*bits
,
704 enum ldlm_mode l_req_mode
);
705 enum ldlm_mode
ll_take_md_lock(struct inode
*inode
, __u64 bits
,
706 struct lustre_handle
*lockh
, __u64 flags
,
707 enum ldlm_mode mode
);
708 int ll_file_open(struct inode
*inode
, struct file
*file
);
709 int ll_file_release(struct inode
*inode
, struct file
*file
);
710 int ll_glimpse_ioctl(struct ll_sb_info
*sbi
,
711 struct lov_stripe_md
*lsm
, lstat_t
*st
);
712 void ll_ioepoch_open(struct ll_inode_info
*lli
, __u64 ioepoch
);
713 int ll_release_openhandle(struct inode
*, struct lookup_intent
*);
714 int ll_md_real_close(struct inode
*inode
, fmode_t fmode
);
715 void ll_ioepoch_close(struct inode
*inode
, struct md_op_data
*op_data
,
716 struct obd_client_handle
**och
, unsigned long flags
);
717 void ll_done_writing_attr(struct inode
*inode
, struct md_op_data
*op_data
);
718 int ll_som_update(struct inode
*inode
, struct md_op_data
*op_data
);
719 int ll_inode_getattr(struct inode
*inode
, struct obdo
*obdo
,
720 __u64 ioepoch
, int sync
);
721 void ll_pack_inode2opdata(struct inode
*inode
, struct md_op_data
*op_data
,
722 struct lustre_handle
*fh
);
723 int ll_getattr(struct vfsmount
*mnt
, struct dentry
*de
, struct kstat
*stat
);
724 struct posix_acl
*ll_get_acl(struct inode
*inode
, int type
);
725 int ll_migrate(struct inode
*parent
, struct file
*file
, int mdtidx
,
726 const char *name
, int namelen
);
727 int ll_get_fid_by_name(struct inode
*parent
, const char *name
,
728 int namelen
, struct lu_fid
*fid
);
729 int ll_inode_permission(struct inode
*inode
, int mask
);
731 int ll_lov_setstripe_ea_info(struct inode
*inode
, struct dentry
*dentry
,
732 __u64 flags
, struct lov_user_md
*lum
,
734 int ll_lov_getstripe_ea_info(struct inode
*inode
, const char *filename
,
735 struct lov_mds_md
**lmm
, int *lmm_size
,
736 struct ptlrpc_request
**request
);
737 int ll_dir_setstripe(struct inode
*inode
, struct lov_user_md
*lump
,
739 int ll_dir_getstripe(struct inode
*inode
, void **lmmp
, int *lmm_size
,
740 struct ptlrpc_request
**request
, u64 valid
);
741 int ll_fsync(struct file
*file
, loff_t start
, loff_t end
, int data
);
742 int ll_merge_attr(const struct lu_env
*env
, struct inode
*inode
);
743 int ll_fid2path(struct inode
*inode
, void __user
*arg
);
744 int ll_data_version(struct inode
*inode
, __u64
*data_version
, int flags
);
745 int ll_hsm_release(struct inode
*inode
);
749 int ll_d_init(struct dentry
*de
);
750 extern const struct dentry_operations ll_d_ops
;
751 void ll_intent_drop_lock(struct lookup_intent
*);
752 void ll_intent_release(struct lookup_intent
*);
753 void ll_invalidate_aliases(struct inode
*);
754 void ll_lookup_finish_locks(struct lookup_intent
*it
, struct inode
*inode
);
755 int ll_revalidate_it_finish(struct ptlrpc_request
*request
,
756 struct lookup_intent
*it
, struct inode
*inode
);
758 /* llite/llite_lib.c */
759 extern struct super_operations lustre_super_operations
;
761 void ll_lli_init(struct ll_inode_info
*lli
);
762 int ll_fill_super(struct super_block
*sb
, struct vfsmount
*mnt
);
763 void ll_put_super(struct super_block
*sb
);
764 void ll_kill_super(struct super_block
*sb
);
765 struct inode
*ll_inode_from_resource_lock(struct ldlm_lock
*lock
);
766 void ll_clear_inode(struct inode
*inode
);
767 int ll_setattr_raw(struct dentry
*dentry
, struct iattr
*attr
, bool hsm_import
);
768 int ll_setattr(struct dentry
*de
, struct iattr
*attr
);
769 int ll_statfs(struct dentry
*de
, struct kstatfs
*sfs
);
770 int ll_statfs_internal(struct super_block
*sb
, struct obd_statfs
*osfs
,
771 __u64 max_age
, __u32 flags
);
772 int ll_update_inode(struct inode
*inode
, struct lustre_md
*md
);
773 int ll_read_inode2(struct inode
*inode
, void *opaque
);
774 void ll_delete_inode(struct inode
*inode
);
775 int ll_iocontrol(struct inode
*inode
, struct file
*file
,
776 unsigned int cmd
, unsigned long arg
);
777 int ll_flush_ctx(struct inode
*inode
);
778 void ll_umount_begin(struct super_block
*sb
);
779 int ll_remount_fs(struct super_block
*sb
, int *flags
, char *data
);
780 int ll_show_options(struct seq_file
*seq
, struct dentry
*dentry
);
781 void ll_dirty_page_discard_warn(struct page
*page
, int ioret
);
782 int ll_prep_inode(struct inode
**inode
, struct ptlrpc_request
*req
,
783 struct super_block
*, struct lookup_intent
*);
784 int ll_obd_statfs(struct inode
*inode
, void __user
*arg
);
785 int ll_get_max_mdsize(struct ll_sb_info
*sbi
, int *max_mdsize
);
786 int ll_get_default_mdsize(struct ll_sb_info
*sbi
, int *default_mdsize
);
787 int ll_process_config(struct lustre_cfg
*lcfg
);
790 LUSTRE_OPC_MKDIR
= 0,
791 LUSTRE_OPC_SYMLINK
= 1,
792 LUSTRE_OPC_MKNOD
= 2,
793 LUSTRE_OPC_CREATE
= 3,
797 struct md_op_data
*ll_prep_md_op_data(struct md_op_data
*op_data
,
798 struct inode
*i1
, struct inode
*i2
,
799 const char *name
, int namelen
,
800 int mode
, __u32 opc
, void *data
);
801 void ll_finish_md_op_data(struct md_op_data
*op_data
);
802 int ll_get_obd_name(struct inode
*inode
, unsigned int cmd
, unsigned long arg
);
803 char *ll_get_fsname(struct super_block
*sb
, char *buf
, int buflen
);
804 void ll_compute_rootsquash_state(struct ll_sb_info
*sbi
);
805 void ll_open_cleanup(struct super_block
*sb
, struct ptlrpc_request
*open_req
);
807 /* llite/llite_nfs.c */
808 extern const struct export_operations lustre_export_operations
;
809 __u32
get_uuid2int(const char *name
, int len
);
810 void get_uuid2fsid(const char *name
, int len
, __kernel_fsid_t
*fsid
);
811 struct inode
*search_inode_for_lustre(struct super_block
*sb
,
812 const struct lu_fid
*fid
);
813 int ll_dir_get_parent_fid(struct inode
*dir
, struct lu_fid
*parent_fid
);
815 /* llite/symlink.c */
816 extern const struct inode_operations ll_fast_symlink_inode_operations
;
818 /* llite/llite_close.c */
819 struct ll_close_queue
{
821 struct list_head lcq_head
;
822 wait_queue_head_t lcq_waitq
;
823 struct completion lcq_comp
;
827 void vvp_write_pending(struct vvp_object
*club
, struct vvp_page
*page
);
828 void vvp_write_complete(struct vvp_object
*club
, struct vvp_page
*page
);
831 * IO arguments for various VFS I/O interfaces.
835 enum vvp_io_subtype via_io_subtype
;
839 struct kiocb
*via_iocb
;
840 struct iov_iter
*via_iter
;
843 struct pipe_inode_info
*via_pipe
;
844 unsigned int via_flags
;
849 struct ll_cl_context
{
850 struct list_head lcc_list
;
852 const struct lu_env
*lcc_env
;
853 struct cl_io
*lcc_io
;
854 struct cl_page
*lcc_page
;
857 struct ll_thread_info
{
858 struct vvp_io_args lti_args
;
859 struct ra_io_arg lti_ria
;
860 struct ll_cl_context lti_io_ctx
;
863 extern struct lu_context_key ll_thread_key
;
864 static inline struct ll_thread_info
*ll_env_info(const struct lu_env
*env
)
866 struct ll_thread_info
*lti
;
868 lti
= lu_context_key_get(&env
->le_ctx
, &ll_thread_key
);
873 static inline struct vvp_io_args
*ll_env_args(const struct lu_env
*env
,
874 enum vvp_io_subtype type
)
876 struct vvp_io_args
*via
= &ll_env_info(env
)->lti_args
;
878 via
->via_io_subtype
= type
;
883 void ll_queue_done_writing(struct inode
*inode
, unsigned long flags
);
884 void ll_close_thread_shutdown(struct ll_close_queue
*lcq
);
885 int ll_close_thread_start(struct ll_close_queue
**lcq_ret
);
887 /* llite/llite_mmap.c */
889 int ll_teardown_mmaps(struct address_space
*mapping
, __u64 first
, __u64 last
);
890 int ll_file_mmap(struct file
*file
, struct vm_area_struct
*vma
);
891 void policy_from_vma(ldlm_policy_data_t
*policy
, struct vm_area_struct
*vma
,
892 unsigned long addr
, size_t count
);
893 struct vm_area_struct
*our_vma(struct mm_struct
*mm
, unsigned long addr
,
896 static inline void ll_invalidate_page(struct page
*vmpage
)
898 struct address_space
*mapping
= vmpage
->mapping
;
899 loff_t offset
= vmpage
->index
<< PAGE_SHIFT
;
901 LASSERT(PageLocked(vmpage
));
906 * truncate_complete_page() calls
907 * a_ops->invalidatepage()->cl_page_delete()->vvp_page_delete().
909 ll_teardown_mmaps(mapping
, offset
, offset
+ PAGE_SIZE
);
910 truncate_complete_page(mapping
, vmpage
);
913 #define ll_s2sbi(sb) (s2lsi(sb)->lsi_llsbi)
915 /* don't need an addref as the sb_info should be holding one */
916 static inline struct obd_export
*ll_s2dtexp(struct super_block
*sb
)
918 return ll_s2sbi(sb
)->ll_dt_exp
;
921 /* don't need an addref as the sb_info should be holding one */
922 static inline struct obd_export
*ll_s2mdexp(struct super_block
*sb
)
924 return ll_s2sbi(sb
)->ll_md_exp
;
927 static inline struct client_obd
*sbi2mdc(struct ll_sb_info
*sbi
)
929 struct obd_device
*obd
= sbi
->ll_md_exp
->exp_obd
;
936 /* FIXME: replace the name of this with LL_SB to conform to kernel stuff */
937 static inline struct ll_sb_info
*ll_i2sbi(struct inode
*inode
)
939 return ll_s2sbi(inode
->i_sb
);
942 static inline struct obd_export
*ll_i2dtexp(struct inode
*inode
)
944 return ll_s2dtexp(inode
->i_sb
);
947 static inline struct obd_export
*ll_i2mdexp(struct inode
*inode
)
949 return ll_s2mdexp(inode
->i_sb
);
952 static inline struct lu_fid
*ll_inode2fid(struct inode
*inode
)
957 fid
= &ll_i2info(inode
)->lli_fid
;
962 static inline __u64
ll_file_maxbytes(struct inode
*inode
)
964 return ll_i2info(inode
)->lli_maxbytes
;
968 extern const struct xattr_handler
*ll_xattr_handlers
[];
970 ssize_t
ll_listxattr(struct dentry
*dentry
, char *buffer
, size_t size
);
973 * Common IO arguments for various VFS I/O interfaces.
975 int cl_sb_init(struct super_block
*sb
);
976 int cl_sb_fini(struct super_block
*sb
);
977 void ll_io_init(struct cl_io
*io
, const struct file
*file
, int write
);
979 void ras_update(struct ll_sb_info
*sbi
, struct inode
*inode
,
980 struct ll_readahead_state
*ras
, unsigned long index
,
982 void ll_ra_count_put(struct ll_sb_info
*sbi
, unsigned long len
);
983 void ll_ra_stats_inc(struct inode
*inode
, enum ra_stat which
);
986 #define LL_SA_RPC_MIN 2
987 #define LL_SA_RPC_DEF 32
988 #define LL_SA_RPC_MAX 8192
990 #define LL_SA_CACHE_BIT 5
991 #define LL_SA_CACHE_SIZE (1 << LL_SA_CACHE_BIT)
992 #define LL_SA_CACHE_MASK (LL_SA_CACHE_SIZE - 1)
994 /* per inode struct, for dir only */
995 struct ll_statahead_info
{
996 struct inode
*sai_inode
;
997 atomic_t sai_refcount
; /* when access this struct, hold
1000 unsigned int sai_generation
; /* generation for statahead */
1001 unsigned int sai_max
; /* max ahead of lookup */
1002 __u64 sai_sent
; /* stat requests sent count */
1003 __u64 sai_replied
; /* stat requests which received
1006 __u64 sai_index
; /* index of statahead entry */
1007 __u64 sai_index_wait
; /* index of entry which is the
1008 * caller is waiting for
1010 __u64 sai_hit
; /* hit count */
1011 __u64 sai_miss
; /* miss count:
1012 * for "ls -al" case, it includes
1013 * hidden dentry miss;
1014 * for "ls -l" case, it does not
1015 * include hidden dentry miss.
1016 * "sai_miss_hidden" is used for
1019 unsigned int sai_consecutive_miss
; /* consecutive miss */
1020 unsigned int sai_miss_hidden
;/* "ls -al", but first dentry
1021 * is not a hidden one
1023 unsigned int sai_skip_hidden
;/* skipped hidden dentry count */
1024 unsigned int sai_ls_all
:1, /* "ls -al", do stat-ahead for
1027 sai_agl_valid
:1,/* AGL is valid for the dir */
1028 sai_in_readpage
:1;/* statahead is in readdir() */
1029 wait_queue_head_t sai_waitq
; /* stat-ahead wait queue */
1030 struct ptlrpc_thread sai_thread
; /* stat-ahead thread */
1031 struct ptlrpc_thread sai_agl_thread
; /* AGL thread */
1032 struct list_head sai_entries
; /* entry list */
1033 struct list_head sai_entries_received
; /* entries returned */
1034 struct list_head sai_entries_stated
; /* entries stated */
1035 struct list_head sai_entries_agl
; /* AGL entries to be sent */
1036 struct list_head sai_cache
[LL_SA_CACHE_SIZE
];
1037 spinlock_t sai_cache_lock
[LL_SA_CACHE_SIZE
];
1038 atomic_t sai_cache_count
; /* entry count in cache */
1041 int do_statahead_enter(struct inode
*dir
, struct dentry
**dentry
,
1043 void ll_stop_statahead(struct inode
*dir
, void *key
);
1045 blkcnt_t
dirty_cnt(struct inode
*inode
);
1047 int cl_glimpse_size0(struct inode
*inode
, int agl
);
1048 int cl_glimpse_lock(const struct lu_env
*env
, struct cl_io
*io
,
1049 struct inode
*inode
, struct cl_object
*clob
, int agl
);
1051 static inline int cl_glimpse_size(struct inode
*inode
)
1053 return cl_glimpse_size0(inode
, 0);
1056 static inline int cl_agl(struct inode
*inode
)
1058 return cl_glimpse_size0(inode
, 1);
1061 static inline int ll_glimpse_size(struct inode
*inode
)
1063 struct ll_inode_info
*lli
= ll_i2info(inode
);
1066 down_read(&lli
->lli_glimpse_sem
);
1067 rc
= cl_glimpse_size(inode
);
1068 lli
->lli_glimpse_time
= cfs_time_current();
1069 up_read(&lli
->lli_glimpse_sem
);
1074 ll_statahead_mark(struct inode
*dir
, struct dentry
*dentry
)
1076 struct ll_inode_info
*lli
= ll_i2info(dir
);
1077 struct ll_statahead_info
*sai
= lli
->lli_sai
;
1078 struct ll_dentry_data
*ldd
= ll_d2d(dentry
);
1080 /* not the same process, don't mark */
1081 if (lli
->lli_opendir_pid
!= current_pid())
1086 ldd
->lld_sa_generation
= sai
->sai_generation
;
1090 d_need_statahead(struct inode
*dir
, struct dentry
*dentryp
)
1092 struct ll_inode_info
*lli
;
1093 struct ll_dentry_data
*ldd
;
1095 if (ll_i2sbi(dir
)->ll_sa_max
== 0)
1098 lli
= ll_i2info(dir
);
1099 /* not the same process, don't statahead */
1100 if (lli
->lli_opendir_pid
!= current_pid())
1103 /* statahead has been stopped */
1104 if (!lli
->lli_opendir_key
)
1107 ldd
= ll_d2d(dentryp
);
1109 * When stats a dentry, the system trigger more than once "revalidate"
1110 * or "lookup", for "getattr", for "getxattr", and maybe for others.
1111 * Under patchless client mode, the operation intent is not accurate,
1112 * which maybe misguide the statahead thread. For example:
1113 * The "revalidate" call for "getattr" and "getxattr" of a dentry maybe
1114 * have the same operation intent -- "IT_GETATTR".
1115 * In fact, one dentry should has only one chance to interact with the
1116 * statahead thread, otherwise the statahead windows will be confused.
1117 * The solution is as following:
1118 * Assign "lld_sa_generation" with "sai_generation" when a dentry
1119 * "IT_GETATTR" for the first time, and the subsequent "IT_GETATTR"
1120 * will bypass interacting with statahead thread for checking:
1121 * "lld_sa_generation == lli_sai->sai_generation"
1123 if (ldd
&& lli
->lli_sai
&&
1124 ldd
->lld_sa_generation
== lli
->lli_sai
->sai_generation
)
1131 ll_statahead_enter(struct inode
*dir
, struct dentry
**dentryp
, int only_unplug
)
1135 ret
= d_need_statahead(dir
, *dentryp
);
1139 return do_statahead_enter(dir
, dentryp
, only_unplug
);
1142 /* llite ioctl register support routine */
1148 #define LLIOC_MAX_CMD 256
1151 * Rules to write a callback function:
1154 * @magic: Dynamic ioctl call routine will feed this value with the pointer
1155 * returned to ll_iocontrol_register. Callback functions should use this
1156 * data to check the potential collasion of ioctl cmd. If collasion is
1157 * found, callback function should return LLIOC_CONT.
1158 * @rcp: The result of ioctl command.
1161 * If @magic matches the pointer returned by ll_iocontrol_data, the
1162 * callback should return LLIOC_STOP; return LLIOC_STOP otherwise.
1164 typedef enum llioc_iter (*llioc_callback_t
)(struct inode
*inode
,
1165 struct file
*file
, unsigned int cmd
, unsigned long arg
,
1166 void *magic
, int *rcp
);
1168 /* export functions */
1169 /* Register ioctl block dynamatically for a regular file.
1171 * @cmd: the array of ioctl command set
1172 * @count: number of commands in the @cmd
1173 * @cb: callback function, it will be called if an ioctl command is found to
1174 * belong to the command list @cmd.
1177 * A magic pointer will be returned if success;
1178 * otherwise, NULL will be returned.
1180 void *ll_iocontrol_register(llioc_callback_t cb
, int count
, unsigned int *cmd
);
1181 void ll_iocontrol_unregister(void *magic
);
1183 int cl_sync_file_range(struct inode
*inode
, loff_t start
, loff_t end
,
1184 enum cl_fsync_mode mode
, int ignore_layout
);
1186 /** direct write pages */
1187 struct ll_dio_pages
{
1188 /** page array to be written. we don't support
1189 * partial pages except the last one.
1191 struct page
**ldp_pages
;
1192 /* offset of each page */
1193 loff_t
*ldp_offsets
;
1194 /** if ldp_offsets is NULL, it means a sequential
1195 * pages to be written, then this is the file offset
1196 * of the first page.
1198 loff_t ldp_start_offset
;
1199 /** how many bytes are to be written. */
1201 /** # of pages in the array. */
1205 static inline void cl_stats_tally(struct cl_device
*dev
, enum cl_req_type crt
,
1208 int opc
= (crt
== CRT_READ
) ? LPROC_LL_OSC_READ
:
1211 ll_stats_ops_tally(ll_s2sbi(cl2vvp_dev(dev
)->vdv_sb
), opc
, rc
);
1214 ssize_t
ll_direct_rw_pages(const struct lu_env
*env
, struct cl_io
*io
,
1215 int rw
, struct inode
*inode
,
1216 struct ll_dio_pages
*pv
);
1218 static inline int ll_file_nolock(const struct file
*file
)
1220 struct ll_file_data
*fd
= LUSTRE_FPRIVATE(file
);
1221 struct inode
*inode
= file_inode(file
);
1223 return ((fd
->fd_flags
& LL_FILE_IGNORE_LOCK
) ||
1224 (ll_i2sbi(inode
)->ll_flags
& LL_SBI_NOLCK
));
1227 static inline void ll_set_lock_data(struct obd_export
*exp
, struct inode
*inode
,
1228 struct lookup_intent
*it
, __u64
*bits
)
1230 if (!it
->it_lock_set
) {
1231 struct lustre_handle handle
;
1233 /* If this inode is a remote object, it will get two
1234 * separate locks in different namespaces, Master MDT,
1235 * where the name entry is, will grant LOOKUP lock,
1236 * remote MDT, where the object is, will grant
1237 * UPDATE|PERM lock. The inode will be attached to both
1238 * LOOKUP and PERM locks, so revoking either locks will
1239 * case the dcache being cleared
1241 if (it
->it_remote_lock_mode
) {
1242 handle
.cookie
= it
->it_remote_lock_handle
;
1243 CDEBUG(D_DLMTRACE
, "setting l_data to inode "DFID
"%p for remote lock %#llx\n",
1244 PFID(ll_inode2fid(inode
)), inode
,
1246 md_set_lock_data(exp
, &handle
, inode
, NULL
);
1249 handle
.cookie
= it
->it_lock_handle
;
1251 CDEBUG(D_DLMTRACE
, "setting l_data to inode "DFID
"%p for lock %#llx\n",
1252 PFID(ll_inode2fid(inode
)), inode
, handle
.cookie
);
1254 md_set_lock_data(exp
, &handle
, inode
, &it
->it_lock_bits
);
1255 it
->it_lock_set
= 1;
1259 *bits
= it
->it_lock_bits
;
1262 static inline int d_lustre_invalid(const struct dentry
*dentry
)
1264 struct ll_dentry_data
*lld
= ll_d2d(dentry
);
1266 return !lld
|| lld
->lld_invalid
;
1269 static inline void __d_lustre_invalidate(struct dentry
*dentry
)
1271 struct ll_dentry_data
*lld
= ll_d2d(dentry
);
1274 lld
->lld_invalid
= 1;
1278 * Mark dentry INVALID, if dentry refcount is zero (this is normally case for
1279 * ll_md_blocking_ast), unhash this dentry, and let dcache to reclaim it later;
1280 * else dput() of the last refcount will unhash this dentry and kill it.
1282 static inline void d_lustre_invalidate(struct dentry
*dentry
, int nested
)
1284 CDEBUG(D_DENTRY
, "invalidate dentry %pd (%p) parent %p inode %p refc %d\n",
1286 dentry
->d_parent
, d_inode(dentry
), d_count(dentry
));
1288 spin_lock_nested(&dentry
->d_lock
,
1289 nested
? DENTRY_D_LOCK_NESTED
: DENTRY_D_LOCK_NORMAL
);
1290 __d_lustre_invalidate(dentry
);
1292 * We should be careful about dentries created by d_obtain_alias().
1293 * These dentries are not put in the dentry tree, instead they are
1294 * linked to sb->s_anon through dentry->d_hash.
1295 * shrink_dcache_for_umount() shrinks the tree and sb->s_anon list.
1296 * If we unhashed such a dentry, unmount would not be able to find
1297 * it and busy inodes would be reported.
1299 if (d_count(dentry
) == 0 && !(dentry
->d_flags
& DCACHE_DISCONNECTED
))
1301 spin_unlock(&dentry
->d_lock
);
1304 static inline void d_lustre_revalidate(struct dentry
*dentry
)
1306 spin_lock(&dentry
->d_lock
);
1307 LASSERT(ll_d2d(dentry
));
1308 ll_d2d(dentry
)->lld_invalid
= 0;
1309 spin_unlock(&dentry
->d_lock
);
1313 LL_LAYOUT_GEN_NONE
= ((__u32
)-2), /* layout lock was cancelled */
1314 LL_LAYOUT_GEN_EMPTY
= ((__u32
)-1) /* for empty layout */
1317 int ll_layout_conf(struct inode
*inode
, const struct cl_object_conf
*conf
);
1318 int ll_layout_refresh(struct inode
*inode
, __u32
*gen
);
1319 int ll_layout_restore(struct inode
*inode
, loff_t start
, __u64 length
);
1321 int ll_xattr_init(void);
1322 void ll_xattr_fini(void);
1324 int ll_page_sync_io(const struct lu_env
*env
, struct cl_io
*io
,
1325 struct cl_page
*page
, enum cl_req_type crt
);
1328 int cl_setattr_ost(struct inode
*inode
, const struct iattr
*attr
);
1330 extern struct lu_env
*cl_inode_fini_env
;
1331 extern int cl_inode_fini_refcheck
;
1333 int cl_file_inode_init(struct inode
*inode
, struct lustre_md
*md
);
1334 void cl_inode_fini(struct inode
*inode
);
1335 int cl_local_size(struct inode
*inode
);
1337 __u64
cl_fid_build_ino(const struct lu_fid
*fid
, int api32
);
1338 __u32
cl_fid_build_gen(const struct lu_fid
*fid
);
1340 #endif /* LLITE_INTERNAL_H */