Lines Matching +full:buffered +full:- +full:positive
1 /* SPDX-License-Identifier: GPL-2.0 */
15 #include <linux/radix-tree.h>
33 #include <linux/percpu-rwsem.h>
166 /* File is stream-like */
182 /* File is capable of returning -EAGAIN if I/O will block */
192 * Attribute flags. These should be or-ed together to figure out what
228 * Derek Atkins <warlord@MIT.EDU> 94-10-20
278 * enum positive_aop_returns - aop return codes with specific semantics
283 * to return the page to the active list -- it won't
324 /* non-RWF related bits - start at 16 */
328 /* iocb->ki_waitq is valid */
337 * flag is set, the bio completion handling may set iocb->dio_complete to a
338 * handler function and iocb->private to context information for that handler.
342 * used on the completion side for non-IO generating completions. It's fine to
375 * Only used for async buffered reads, where it denotes the
386 * assigned to ->private when dio_complete is assigned.
394 return kiocb->ki_complete == NULL; in is_sync_kiocb()
444 * struct address_space - Contents of a cacheable, mappable object.
448 * file offset->disk block mappings in the filesystem during invalidates.
453 * @nr_thps: Number of THPs in the pagecache (non-shmem only).
472 /* number of thp, only for non-shmem files */
502 return xa_marked(&mapping->i_pages, tag); in mapping_tagged()
507 down_write(&mapping->i_mmap_rwsem); in i_mmap_lock_write()
512 return down_write_trylock(&mapping->i_mmap_rwsem); in i_mmap_trylock_write()
517 up_write(&mapping->i_mmap_rwsem); in i_mmap_unlock_write()
522 return down_read_trylock(&mapping->i_mmap_rwsem); in i_mmap_trylock_read()
527 down_read(&mapping->i_mmap_rwsem); in i_mmap_lock_read()
532 up_read(&mapping->i_mmap_rwsem); in i_mmap_unlock_read()
537 lockdep_assert_held(&mapping->i_mmap_rwsem); in i_mmap_assert_locked()
542 lockdep_assert_held_write(&mapping->i_mmap_rwsem); in i_mmap_assert_write_locked()
550 return !RB_EMPTY_ROOT(&mapping->i_mmap.rb_root); in mapping_mapped()
564 return atomic_read(&mapping->i_mmap_writable) > 0; in mapping_writably_mapped()
569 return atomic_inc_unless_negative(&mapping->i_mmap_writable) ? in mapping_map_writable()
570 0 : -EPERM; in mapping_map_writable()
575 atomic_dec(&mapping->i_mmap_writable); in mapping_unmap_writable()
580 return atomic_dec_unless_positive(&mapping->i_mmap_writable) ? in mapping_deny_writable()
581 0 : -EBUSY; in mapping_deny_writable()
586 atomic_inc(&mapping->i_mmap_writable); in mapping_allow_writable()
590 * Use sequence counter to get consistent i_size on 32-bit processors.
595 #define i_size_ordered_init(inode) seqcount_init(&inode->i_size_seqcount)
601 #define ACL_NOT_CACHED ((void *)(-1))
604 * cache the ACL. This also means that ->get_inode_acl() can be called in RCU
607 #define ACL_DONT_CACHE ((void *)(-3))
628 * Keep mostly read-only and often accessed (especially for
686 /* 32-bit hole */
718 const struct file_operations *i_fop; /* former ->i_op->default_file_ops */
734 /* 32-bit hole reserved for expanding i_fsnotify_mask */
750 * Get bit address from inode->i_state to use with wait_var_event()
753 #define inode_state_wait_address(inode, bit) ((char *)&(inode)->i_state + (bit))
768 return (1 << node->i_blkbits); in i_blocksize()
773 return hlist_unhashed(&inode->i_hash); in inode_unhashed()
784 hlist_add_fake(&inode->i_hash); in inode_fake_hash()
788 * inode->i_mutex nesting subclasses for the lock validator:
794 * 4: second non-directory
798 * non-directories at once.
801 * parent[2] -> child -> grandchild -> normal -> xattr -> second non-directory
815 down_write(&inode->i_rwsem); in inode_lock()
820 up_write(&inode->i_rwsem); in inode_unlock()
825 down_read(&inode->i_rwsem); in inode_lock_shared()
830 up_read(&inode->i_rwsem); in inode_unlock_shared()
835 return down_write_trylock(&inode->i_rwsem); in inode_trylock()
840 return down_read_trylock(&inode->i_rwsem); in inode_trylock_shared()
845 return rwsem_is_locked(&inode->i_rwsem); in inode_is_locked()
850 down_write_nested(&inode->i_rwsem, subclass); in inode_lock_nested()
855 down_read_nested(&inode->i_rwsem, subclass); in inode_lock_shared_nested()
860 down_write(&mapping->invalidate_lock); in filemap_invalidate_lock()
865 up_write(&mapping->invalidate_lock); in filemap_invalidate_unlock()
870 down_read(&mapping->invalidate_lock); in filemap_invalidate_lock_shared()
876 return down_read_trylock(&mapping->invalidate_lock); in filemap_invalidate_trylock_shared()
882 up_read(&mapping->invalidate_lock); in filemap_invalidate_unlock_shared()
911 seq = read_seqcount_begin(&inode->i_size_seqcount); in i_size_read()
912 i_size = inode->i_size; in i_size_read()
913 } while (read_seqcount_retry(&inode->i_size_seqcount, seq)); in i_size_read()
919 i_size = inode->i_size; in i_size_read()
924 return smp_load_acquire(&inode->i_size); in i_size_read()
937 write_seqcount_begin(&inode->i_size_seqcount); in i_size_write()
938 inode->i_size = i_size; in i_size_write()
939 write_seqcount_end(&inode->i_size_seqcount); in i_size_write()
943 inode->i_size = i_size; in i_size_write()
951 smp_store_release(&inode->i_size, i_size); in i_size_write()
957 return MINOR(inode->i_rdev); in iminor()
962 return MAJOR(inode->i_rdev); in imajor()
968 struct pid *pid; /* pid or -pgrp where SIGIO should be sent */
975 * struct file_ra_state - Track a file's readahead state.
985 * When this structure is passed to ->readahead(), the "most recent"
1002 return (index >= ra->start && in ra_has_index()
1003 index < ra->start + ra->size); in ra_has_index()
1007 * struct file - Represents a file
1043 /* --- cacheline 1 boundary (64 bytes) --- */
1055 /* --- cacheline 2 boundary (128 bytes) --- */
1068 /* --- cacheline 3 boundary (192 bytes) --- */
1081 long prior = atomic_long_fetch_inc_relaxed(&f->f_count); in get_file()
1082 …WARN_ONCE(!prior, "struct file::f_count incremented from zero; use-after-free condition present!\n… in get_file()
1089 #define file_count(x) atomic_long_read(&(x)->f_count)
1091 #define MAX_NON_LFS ((1UL<<31) - 1)
1116 return READ_ONCE(file->f_owner); in file_f_owner()
1123 return f->f_inode; in file_inode()
1136 struct dentry *dentry = file->f_path.dentry; in file_dentry()
1170 * sb->s_flags. Note that these mirror the equivalent MS_* flags where
1173 #define SB_RDONLY BIT(0) /* Mount read-only */
1184 #define SB_INLINECRYPT BIT(17) /* Use blk-crypto for encrypted files */
1187 #define SB_LAZYTIME BIT(25) /* Update the on-disk [acm]times lazily */
1203 (sb->s_encoding_flags & SB_ENC_STRICT_MODE_FL)
1215 /* sb->s_iflags */
1216 #define SB_I_CGROUPWB 0x00000001 /* cgroup-aware writeback enabled */
1221 /* sb->s_iflags to limit user namespace mounts */
1228 #define SB_I_PERSB_BDI 0x00000200 /* has a per-sb bdi */
1241 SB_FREEZE_COMPLETE = 4, /* ->freeze_fs finished successfully */
1244 #define SB_FREEZE_LEVELS (SB_FREEZE_COMPLETE - 1)
1341 * Filesystem subtype. If non-empty the filesystem type field
1348 struct shrinker *s_shrink; /* per-sb shrinker handle */
1353 /* Read-only state of the superblock is being changed */
1356 /* per-sb errseq_t for reporting writeback errors via syncfs */
1372 * of per-node lru lists, each of which has its own spinlock.
1397 return inode->i_sb->s_user_ns; in i_user_ns()
1407 return from_kuid(i_user_ns(inode), inode->i_uid); in i_uid_read()
1412 return from_kgid(i_user_ns(inode), inode->i_gid); in i_gid_read()
1417 inode->i_uid = make_kuid(i_user_ns(inode), uid); in i_uid_write()
1422 inode->i_gid = make_kgid(i_user_ns(inode), gid); in i_gid_write()
1426 * i_uid_into_vfsuid - map an inode's i_uid down according to an idmapping
1436 return make_vfsuid(idmap, i_user_ns(inode), inode->i_uid); in i_uid_into_vfsuid()
1440 * i_uid_needs_update - check whether inode's i_uid needs to be updated
1454 return ((attr->ia_valid & ATTR_UID) && in i_uid_needs_update()
1455 !vfsuid_eq(attr->ia_vfsuid, in i_uid_needs_update()
1460 * i_uid_update - update @inode's i_uid field
1472 if (attr->ia_valid & ATTR_UID) in i_uid_update()
1473 inode->i_uid = from_vfsuid(idmap, i_user_ns(inode), in i_uid_update()
1474 attr->ia_vfsuid); in i_uid_update()
1478 * i_gid_into_vfsgid - map an inode's i_gid down according to an idmapping
1488 return make_vfsgid(idmap, i_user_ns(inode), inode->i_gid); in i_gid_into_vfsgid()
1492 * i_gid_needs_update - check whether inode's i_gid needs to be updated
1506 return ((attr->ia_valid & ATTR_GID) && in i_gid_needs_update()
1507 !vfsgid_eq(attr->ia_vfsgid, in i_gid_needs_update()
1512 * i_gid_update - update @inode's i_gid field
1524 if (attr->ia_valid & ATTR_GID) in i_gid_update()
1525 inode->i_gid = from_vfsgid(idmap, i_user_ns(inode), in i_gid_update()
1526 attr->ia_vfsgid); in i_gid_update()
1530 * inode_fsuid_set - initialize inode's i_uid field with callers fsuid
1540 inode->i_uid = mapped_fsuid(idmap, i_user_ns(inode)); in inode_fsuid_set()
1544 * inode_fsgid_set - initialize inode's i_gid field with callers fsgid
1554 inode->i_gid = mapped_fsgid(idmap, i_user_ns(inode)); in inode_fsgid_set()
1558 * fsuidgid_has_mapping() - check whether caller's fsuid/fsgid is mapped
1571 struct user_namespace *fs_userns = sb->s_user_ns; in fsuidgid_has_mapping()
1590 return inode->i_atime_sec; in inode_get_atime_sec()
1595 return inode->i_atime_nsec; in inode_get_atime_nsec()
1609 inode->i_atime_sec = ts.tv_sec; in inode_set_atime_to_ts()
1610 inode->i_atime_nsec = ts.tv_nsec; in inode_set_atime_to_ts()
1625 return inode->i_mtime_sec; in inode_get_mtime_sec()
1630 return inode->i_mtime_nsec; in inode_get_mtime_nsec()
1643 inode->i_mtime_sec = ts.tv_sec; in inode_set_mtime_to_ts()
1644 inode->i_mtime_nsec = ts.tv_nsec; in inode_set_mtime_to_ts()
1658 return inode->i_ctime_sec; in inode_get_ctime_sec()
1663 return inode->i_ctime_nsec; in inode_get_ctime_nsec()
1677 inode->i_ctime_sec = ts.tv_sec; in inode_set_ctime_to_ts()
1678 inode->i_ctime_nsec = ts.tv_nsec; in inode_set_ctime_to_ts()
1683 * inode_set_ctime - set the ctime in the inode
1711 percpu_up_read(sb->s_writers.rw_sem + level-1); in __sb_end_write()
1716 percpu_down_read(sb->s_writers.rw_sem + level - 1); in __sb_start_write()
1721 return percpu_down_read_trylock(sb->s_writers.rw_sem + level - 1); in __sb_start_write_trylock()
1725 percpu_rwsem_acquire(&(sb)->s_writers.rw_sem[(lev)-1], 1, _THIS_IP_)
1727 percpu_rwsem_release(&(sb)->s_writers.rw_sem[(lev)-1], _THIS_IP_)
1730 * __sb_write_started - check if sb freeze level is held
1734 * * > 0 - sb freeze level is held
1735 * * 0 - sb freeze level is not held
1736 * * < 0 - !CONFIG_LOCKDEP/LOCK_STATE_UNKNOWN
1740 return lockdep_is_held_type(sb->s_writers.rw_sem + level - 1, 1); in __sb_write_started()
1744 * sb_write_started - check if SB_FREEZE_WRITE is held
1747 * May be false positive with !CONFIG_LOCKDEP/LOCK_STATE_UNKNOWN.
1755 * sb_write_not_started - check if SB_FREEZE_WRITE is not held
1758 * May be false positive with !CONFIG_LOCKDEP/LOCK_STATE_UNKNOWN.
1766 * file_write_started - check if SB_FREEZE_WRITE is held
1769 * May be false positive with !CONFIG_LOCKDEP/LOCK_STATE_UNKNOWN.
1770 * May be false positive with !S_ISREG, because file_start_write() has
1775 if (!S_ISREG(file_inode(file)->i_mode)) in file_write_started()
1777 return sb_write_started(file_inode(file)->i_sb); in file_write_started()
1781 * file_write_not_started - check if SB_FREEZE_WRITE is not held
1784 * May be false positive with !CONFIG_LOCKDEP/LOCK_STATE_UNKNOWN.
1785 * May be false positive with !S_ISREG, because file_start_write() has
1790 if (!S_ISREG(file_inode(file)->i_mode)) in file_write_not_started()
1792 return sb_write_not_started(file_inode(file)->i_sb); in file_write_not_started()
1796 * sb_end_write - drop write access to a superblock
1808 * sb_end_pagefault - drop write access to a superblock from a page fault
1820 * sb_end_intwrite - drop write access to a superblock for internal fs purposes
1823 * Decrement fs-internal number of writers to the filesystem. Wake up possible
1832 * sb_start_write - get write access to a superblock
1836 * a page or an inode), it should embed the operation in a sb_start_write() -
1847 * -> i_mutex (write path, truncate, directory ops, ...)
1848 * -> s_umount (freeze_super, thaw_super)
1861 * sb_start_pagefault - get write access to a superblock from a page fault
1865 * operation into sb_start_pagefault() - sb_end_pagefault() pair to get
1877 * -> sb_start_pagefault
1885 * sb_start_intwrite - get write access to a superblock for internal fs purposes
1928 * struct renamedata - contains all information required for renaming
2107 /* Supports async buffered reads */
2109 /* Supports async buffered writes */
2113 /* Supports non-exclusive O_DIRECT writes from multiple threads */
2172 return file->f_op->mmap(file, vma); in call_mmap()
2197 * enum freeze_holder - holder of the freeze
2252 * Inode flags - they have no relation to superblock flags now
2256 #define S_APPEND (1 << 2) /* Append-only file */
2263 #define S_PRIVATE (1 << 9) /* Inode is fs-internal */
2265 #define S_AUTOMOUNT (1 << 11) /* Automount/referral quasi-directory */
2278 * Note that nosuid etc flags are inode-specific: setting some file-system
2288 * flags, so these have to be checked separately. -- rmk@arm.uk.linux.org
2290 #define __IS_FLG(inode, flg) ((inode)->i_sb->s_flags & (flg))
2292 static inline bool sb_rdonly(const struct super_block *sb) { return sb->s_flags & SB_RDONLY; } in sb_rdonly()
2293 #define IS_RDONLY(inode) sb_rdonly((inode)->i_sb)
2295 ((inode)->i_flags & S_SYNC))
2297 ((inode)->i_flags & (S_SYNC|S_DIRSYNC)))
2302 #define IS_NOQUOTA(inode) ((inode)->i_flags & S_NOQUOTA)
2303 #define IS_APPEND(inode) ((inode)->i_flags & S_APPEND)
2304 #define IS_IMMUTABLE(inode) ((inode)->i_flags & S_IMMUTABLE)
2312 #define IS_DEADDIR(inode) ((inode)->i_flags & S_DEAD)
2313 #define IS_NOCMTIME(inode) ((inode)->i_flags & S_NOCMTIME)
2316 #define IS_SWAPFILE(inode) ((inode)->i_flags & S_SWAPFILE)
2321 #define IS_PRIVATE(inode) ((inode)->i_flags & S_PRIVATE)
2322 #define IS_IMA(inode) ((inode)->i_flags & S_IMA)
2323 #define IS_AUTOMOUNT(inode) ((inode)->i_flags & S_AUTOMOUNT)
2324 #define IS_NOSEC(inode) ((inode)->i_flags & S_NOSEC)
2325 #define IS_DAX(inode) ((inode)->i_flags & S_DAX)
2326 #define IS_ENCRYPTED(inode) ((inode)->i_flags & S_ENCRYPTED)
2327 #define IS_CASEFOLDED(inode) ((inode)->i_flags & S_CASEFOLD)
2328 #define IS_VERITY(inode) ((inode)->i_flags & S_VERITY)
2330 #define IS_WHITEOUT(inode) (S_ISCHR(inode->i_mode) && \
2331 (inode)->i_rdev == WHITEOUT_DEV)
2344 .ki_flags = filp->f_iocb_flags, in init_sync_kiocb()
2354 .ki_flags = kiocb_src->ki_flags, in kiocb_clone()
2355 .ki_ioprio = kiocb_src->ki_ioprio, in kiocb_clone()
2356 .ki_pos = kiocb_src->ki_pos, in kiocb_clone()
2361 * Inode state bits. Protected by inode->i_lock
2375 * I_DIRTY_DATASYNC Data-related inode changes pending. We keep track of
2395 * nearly-dead inodes.
2487 * located very nearby on-disk, e.g. in the same inode block. This returns true
2489 * i_lock, or at least later re-checking under i_lock.
2493 return (inode->i_state & (I_DIRTY_TIME | I_NEW | in inode_is_dirtytime_only()
2527 if (!(file->f_flags & O_NOATIME)) in file_accessed()
2528 touch_atime(&file->f_path); in file_accessed()
2566 #define MODULE_ALIAS_FS(NAME) MODULE_ALIAS("fs-" NAME)
2601 (((_fops) && try_module_get((_fops)->owner) ? (_fops) : NULL)); \
2607 module_put((_fops)->owner); \
2611 * This one is to be used *ONLY* from ->open() instances.
2612 * fops must be non-NULL, pinned down *and* module dependencies
2618 fops_put(__file->f_op); \
2619 BUG_ON(!(__file->f_op = (fops))); \
2635 if (WARN_ON(len > sizeof(sb->s_uuid))) in super_set_uuid()
2636 len = sizeof(sb->s_uuid); in super_set_uuid()
2637 sb->s_uuid_len = len; in super_set_uuid()
2638 memcpy(&sb->s_uuid, uuid, len); in super_set_uuid()
2641 /* set sb sysfs name based on sb->s_bdev */
2644 snprintf(sb->s_sysfs_name, sizeof(sb->s_sysfs_name), "%pg", sb->s_bdev); in super_set_sysfs_name_bdev()
2647 /* set sb sysfs name based on sb->s_uuid */
2650 WARN_ON(sb->s_uuid_len != sizeof(sb->s_uuid)); in super_set_sysfs_name_uuid()
2651 snprintf(sb->s_sysfs_name, sizeof(sb->s_sysfs_name), "%pU", sb->s_uuid.b); in super_set_sysfs_name_uuid()
2654 /* set sb sysfs name based on sb->s_id */
2657 strscpy(sb->s_sysfs_name, sb->s_id, sizeof(sb->s_sysfs_name)); in super_set_sysfs_name_id()
2667 vsnprintf(sb->s_sysfs_name, sizeof(sb->s_sysfs_name), fmt, args); in super_set_sysfs_name_generic()
2696 return mnt_idmap(file->f_path.mnt); in file_mnt_idmap()
2700 * is_idmapped_mnt - check whether a mount is mapped
2726 return file_open_root(&(struct path){.mnt = mnt, .dentry = mnt->mnt_root}, in file_open_root_mnt()
2737 * stored in ->vm_file is a backing file whose f_inode is on the underlying
2747 if (unlikely(f->f_mode & FMODE_BACKING)) in file_user_path()
2749 return &f->f_path; in file_user_path()
2754 if (unlikely(f->f_mode & FMODE_BACKING)) in file_user_inode()
2755 return d_inode(backing_file_user_path(f)->dentry); in file_user_inode()
2761 return dentry_open(&file->f_path, file->f_flags, file->f_cred); in file_clone_open()
2781 return finish_open(file, file->f_path.dentry, NULL); in finish_open_simple()
2835 /* Invalid inode operations -- fs/bad_inode.c */
2859 return (iocb->ki_flags & IOCB_DSYNC) || in iocb_is_dsync()
2860 IS_SYNC(iocb->ki_filp->f_mapping->host); in iocb_is_dsync()
2871 int ret = vfs_fsync_range(iocb->ki_filp, in generic_write_sync()
2872 iocb->ki_pos - count, iocb->ki_pos - 1, in generic_write_sync()
2873 (iocb->ki_flags & IOCB_SYNC) ? 0 : 1); in generic_write_sync()
2889 return -EINVAL; in bmap()
2904 return inode_permission(mnt_idmap(path->mnt), in path_permission()
2905 d_inode(path->dentry), mask); in path_permission()
2912 return (inode->i_mode & S_IXUGO) || S_ISDIR(inode->i_mode); in execute_ok()
2917 return (inode->i_mode ^ mode) & S_IFMT; in inode_wrong_type()
2921 * file_start_write - get write access to a superblock for regular file io
2924 * This is a variant of sb_start_write() which is a noop on non-regualr file.
2929 if (!S_ISREG(file_inode(file)->i_mode)) in file_start_write()
2931 sb_start_write(file_inode(file)->i_sb); in file_start_write()
2936 if (!S_ISREG(file_inode(file)->i_mode)) in file_start_write_trylock()
2938 return sb_start_write_trylock(file_inode(file)->i_sb); in file_start_write_trylock()
2942 * file_end_write - drop write access to a superblock of a regular file
2949 if (!S_ISREG(file_inode(file)->i_mode)) in file_end_write()
2951 sb_end_write(file_inode(file)->i_sb); in file_end_write()
2955 * kiocb_start_write - get write access to a superblock for async file io
2963 struct inode *inode = file_inode(iocb->ki_filp); in kiocb_start_write()
2965 sb_start_write(inode->i_sb); in kiocb_start_write()
2970 __sb_writers_release(inode->i_sb, SB_FREEZE_WRITE); in kiocb_start_write()
2974 * kiocb_end_write - drop write access to a superblock after async file io
2981 struct inode *inode = file_inode(iocb->ki_filp); in kiocb_end_write()
2986 __sb_writers_acquired(inode->i_sb, SB_FREEZE_WRITE); in kiocb_end_write()
2987 sb_end_write(inode->i_sb); in kiocb_end_write()
2991 * This is used for regular files where some users -- especially the
2993 * VM_DENYWRITE -- cannot handle concurrent write (and maybe mmap
2994 * read-write shared) accesses.
2999 * allow_write_access() re-enables write access to a file.
3003 * < 0: (-i_writecount) users that denied write access to the file.
3008 * use {get,deny}_write_access() - these functions check the sign and refuse
3013 return atomic_inc_unless_negative(&inode->i_writecount) ? 0 : -ETXTBSY; in get_write_access()
3018 return atomic_dec_unless_positive(&inode->i_writecount) ? 0 : -ETXTBSY; in deny_write_access()
3022 atomic_dec(&inode->i_writecount); in put_write_access()
3027 atomic_inc(&file_inode(file)->i_writecount); in allow_write_access()
3031 return atomic_read(&inode->i_writecount) > 0; in inode_is_open_for_write()
3037 BUG_ON(atomic_dec_return(&inode->i_readcount) < 0); in i_readcount_dec()
3041 atomic_inc(&inode->i_readcount); in i_readcount_inc()
3061 /* fs/dcache.c -- generic fs support functions */
3068 * is_dot_dotdot - returns true only if @name is "." or ".."
3099 return !inode->i_nlink || inode_unhashed(inode); in generic_drop_inode()
3143 * Userspace may rely on the inode number being non-zero. For example, glibc
3147 * _FILE_OFFSET_BITS=32 on a 64-bit kernel we'll only end up reading out the
3149 * _FILE_OFFSET_BITS=64, this may cause some harmless false-negatives, but
3158 * inode->i_lock must be held
3162 atomic_inc(&inode->i_count); in __iget()
3181 #define alloc_inode_sb(_sb, _cache, _gfp) kmem_cache_alloc_lru(_cache, &_sb->s_inode_lru, _gfp)
3186 __insert_inode_hash(inode, inode->i_ino); in insert_inode_hash()
3192 if (!inode_unhashed(inode) && !hlist_fake(&inode->i_hash)) in remove_inode_hash()
3262 /* need locking between buffered and direct access */
3280 return __blockdev_direct_IO(iocb, inode, inode->i_sb->s_bdev, iter, in blockdev_direct_IO()
3290 * inode_dio_begin - signal start of a direct I/O requests
3298 atomic_inc(&inode->i_dio_count); in inode_dio_begin()
3302 * inode_dio_end - signal finish of a direct I/O requests
3310 if (atomic_dec_and_test(&inode->i_dio_count)) in inode_dio_end()
3311 wake_up_var(&inode->i_dio_count); in inode_dio_end()
3342 return (((loff_t)inode->i_blocks) << 9) + inode->i_bytes; in __inode_get_bytes()
3462 return !!sb->s_encoding; in sb_has_encoding()
3479 return vma->vm_file && IS_DAX(vma->vm_file->f_mapping->host); in vma_is_dax()
3486 if (!IS_ENABLED(CONFIG_FS_DAX) || !vma->vm_file) in vma_is_fsdax()
3490 inode = file_inode(vma->vm_file); in vma_is_fsdax()
3491 if (S_ISCHR(inode->i_mode)) in vma_is_fsdax()
3492 return false; /* device-dax */ in vma_is_fsdax()
3499 if (file->f_flags & O_APPEND) in iocb_flags()
3501 if (file->f_flags & O_DIRECT) in iocb_flags()
3503 if (file->f_flags & O_DSYNC) in iocb_flags()
3505 if (file->f_flags & __O_SYNC) in iocb_flags()
3521 return -EOPNOTSUPP; in kiocb_set_rw_flags()
3523 return -EINVAL; in kiocb_set_rw_flags()
3526 if (!(ki->ki_filp->f_mode & FMODE_NOWAIT)) in kiocb_set_rw_flags()
3527 return -EOPNOTSUPP; in kiocb_set_rw_flags()
3531 return -EOPNOTSUPP; in kiocb_set_rw_flags()
3532 if (!(ki->ki_filp->f_mode & FMODE_CAN_ATOMIC_WRITE)) in kiocb_set_rw_flags()
3533 return -EOPNOTSUPP; in kiocb_set_rw_flags()
3539 if ((flags & RWF_NOAPPEND) && (ki->ki_flags & IOCB_APPEND)) { in kiocb_set_rw_flags()
3540 if (IS_APPEND(file_inode(ki->ki_filp))) in kiocb_set_rw_flags()
3541 return -EPERM; in kiocb_set_rw_flags()
3542 ki->ki_flags &= ~IOCB_APPEND; in kiocb_set_rw_flags()
3545 ki->ki_flags |= kiocb_flags; in kiocb_set_rw_flags()
3560 #define SIMPLE_TRANSACTION_LIMIT (PAGE_SIZE - sizeof(struct simple_transaction_argresp))
3642 if (!(dir->i_mode & S_ISVTX)) in check_sticky()
3650 if (!is_sxid(inode->i_mode) && (inode->i_sb->s_flags & SB_NOSEC)) in inode_has_no_xattr()
3651 inode->i_flags |= S_NOSEC; in inode_has_no_xattr()
3656 return inode == inode->i_sb->s_root->d_inode; in is_root_inode()
3663 return ctx->actor(ctx, name, namelen, ctx->pos, ino, type); in dir_emit()
3667 return ctx->actor(ctx, ".", 1, ctx->pos, in dir_emit_dot()
3668 file->f_path.dentry->d_inode->i_ino, DT_DIR); in dir_emit_dot()
3672 return ctx->actor(ctx, "..", 2, ctx->pos, in dir_emit_dotdot()
3673 d_parent_ino(file->f_path.dentry), DT_DIR); in dir_emit_dotdot()
3677 if (ctx->pos == 0) { in dir_emit_dots()
3680 ctx->pos = 1; in dir_emit_dots()
3682 if (ctx->pos == 1) { in dir_emit_dots()
3685 ctx->pos = 2; in dir_emit_dots()