mint0x33/include/linux/posix_acl.h
Jaegeuk Kim ce767d9a55 f2fs: updates on v4.16-rc1
Pull f2fs updates from Jaegeuk Kim:
 "In this round, we've followed up to support some generic features such
  as cgroup, block reservation, linking fscrypt_ops, delivering
  write_hints, and some ioctls. And, we could fix some corner cases in
  terms of power-cut recovery and subtle deadlocks.

  Enhancements:
   - bitmap operations to handle NAT blocks
   - readahead to improve readdir speed
   - switch to use fscrypt_*
   - apply write hints for direct IO
   - add reserve_root=%u,resuid=%u,resgid=%u to reserve blocks for root/uid/gid
   - modify b_avail and b_free to consider root reserved blocks
   - support cgroup writeback
   - support FIEMAP_FLAG_XATTR for fibmap
   - add F2FS_IOC_PRECACHE_EXTENTS to pre-cache extents
   - add F2FS_IOC_{GET/SET}_PIN_FILE to pin LBAs for data blocks
   - support inode creation time

  Bug fixs:
   - sysfile-based quota operations
   - memory footprint accounting
   - allow to write data on partial preallocation case
   - fix deadlock case on fallocate
   - fix to handle fill_super errors
   - fix missing inode updates of fsync'ed file
   - recover renamed file which was fsycn'ed before
   - drop inmemory pages in corner error case
   - keep last_disk_size correctly
   - recover missing i_inline flags during roll-forward

  Various clean-up patches were added as well"

Cherry-pick from origin/upstream-f2fs-stable-linux-4.14.y:

00f0eaaadf f2fs: support inode creation time
3e7444adf9 f2fs: rebuild sit page from sit info in mem
76688790c3 f2fs: stop issuing discard if fs is readonly
ae93dca264 f2fs: clean up duplicated assignment in init_discard_policy
0052bba131 f2fs: use GFP_F2FS_ZERO for cleanup
6271336cfa f2fs: allow to recover node blocks given updated checkpoint
e003a2d153 f2fs: recover some i_inline flags
3cafae53f3 f2fs: correct removexattr behavior for null valued extended attribute
78d7fa9ac2 f2fs: drop page cache after fs shutdown
150b61cee5 f2fs: stop gc/discard thread after fs shutdown
cf27ccc41e f2fs: hanlde error case in f2fs_ioc_shutdown
1526117cda f2fs: split need_inplace_update
cd576d7b7a f2fs: fix to update last_disk_size correctly
7a57bd3313 f2fs: kill F2FS_INLINE_XATTR_ADDRS for cleanup
95eb6a6ceb f2fs: clean up error path of fill_super
63c949c973 f2fs: avoid hungtask when GC encrypted block if io_bits is set
583d13d10c f2fs: allow quota to use reserved blocks
fbe371d3cd f2fs: fix to drop all inmem pages correctly
7e08ce4356 f2fs: speed up defragment on sparse file
0f914cab8c f2fs: support F2FS_IOC_PRECACHE_EXTENTS
ed1311e585 f2fs: add an ioctl to disable GC for specific file
b08974ab5e f2fs: prevent newly created inode from being dirtied incorrectly
e8a8acf602 f2fs: support FIEMAP_FLAG_XATTR
042aeed690 f2fs: fix to cover f2fs_inline_data_fiemap with inode_lock
9cf9c37ebe f2fs: check node page again in write end io
b9eedb4813 f2fs: fix to caclulate required free section correctly
75ae50cf15 f2fs: handle newly created page when revoking inmem pages
871b974936 f2fs: add resgid and resuid to reserve root blocks
0cf361acdb f2fs: implement cgroup writeback support
196d52cf4e f2fs: remove unused pend_list_tag
6e899a83f5 f2fs: avoid high cpu usage in discard thread
bb1af976c2 f2fs: make local functions static
ad658936ea f2fs: add reserved blocks for root user
c6e64f1ff1 f2fs: check segment type in __f2fs_replace_block
88cdc60b73 f2fs: update inode info to inode page for new file
4203e9fbd8 f2fs: show precise # of blocks that user/root can use
47dc137291 f2fs: clean up unneeded declaration
27f9e55195 f2fs: continue to do direct IO if we only preallocate partial blocks
f2f1378314 f2fs: enable quota at remount from r to w
d507f30065 f2fs: skip stop_checkpoint for user data writes
4b242ffcdb f2fs: fix missing error number for xattr operation
c6c76a0e61 f2fs: recover directory operations by fsync
5943e3992e f2fs: return error during fill_super
93579c9725 f2fs: fix an error case of missing update inode page
3d753c15af f2fs: fix potential hangtask in f2fs_trace_pid
625f066c5d f2fs: no need return value in restore summary process
f76c831abd f2fs: use unlikely for release case
0408ad5efb f2fs: don't return value in truncate_data_blocks_range
62e507cd2b f2fs: clean up f2fs_map_blocks
233b197757 f2fs: clean up hash codes
58d550e5da f2fs: fix error handling in fill_super
35d78e6fc8 f2fs: spread f2fs_k{m,z}alloc
fecf31ce11 f2fs: inject fault to kvmalloc
41af39db9f f2fs: inject fault to kzalloc
9fecb4159d f2fs: remove a redundant conditional expression
8e56c02ee9 f2fs: apply write hints to select the type of segment for direct write
a4015f9147 f2fs: switch to fscrypt_prepare_setattr()
56351ec774 f2fs: switch to fscrypt_prepare_lookup()
51f2caabf9 f2fs: switch to fscrypt_prepare_rename()
f9a35b22b9 f2fs: switch to fscrypt_prepare_link()
787bd2632d f2fs: switch to fscrypt_file_open()
eb9d8ee0fd posix_acl: convert posix_acl.a_refcount from atomic_t to refcount_t
bd0bb8ab0c f2fs: remove repeated f2fs_bug_on
d1c0441c02 f2fs: remove an excess variable
3f12c94d1b f2fs: fix lock dependency in between dio_rwsem & i_mmap_sem
39685b35e8 f2fs: remove unused parameter
b83577043a f2fs: still write data if preallocate only partial blocks
b61cf21718 f2fs: introduce sysfs readdir_ra to readahead inode block in readdir
44ed9b2d12 f2fs: fix concurrent problem for updating free bitmap
08be3792ef f2fs: remove unneeded memory footprint accounting
33362399b3 f2fs: no need to read nat block if nat_block_bitmap is set
01bb5c8b1f f2fs: reserve nid resource for quota sysfile

Change-Id: Ie0beb18a04fc300d1591d64c7ae542a478644e26
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
2018-02-22 19:18:40 +00:00

124 lines
3.1 KiB
C

/* SPDX-License-Identifier: GPL-2.0 */
/*
File: linux/posix_acl.h
(C) 2002 Andreas Gruenbacher, <a.gruenbacher@computer.org>
*/
#ifndef __LINUX_POSIX_ACL_H
#define __LINUX_POSIX_ACL_H
#include <linux/bug.h>
#include <linux/slab.h>
#include <linux/rcupdate.h>
#include <linux/refcount.h>
#include <uapi/linux/posix_acl.h>
struct posix_acl_entry {
short e_tag;
unsigned short e_perm;
union {
kuid_t e_uid;
kgid_t e_gid;
};
};
struct posix_acl {
refcount_t a_refcount;
struct rcu_head a_rcu;
unsigned int a_count;
struct posix_acl_entry a_entries[0];
};
#define FOREACH_ACL_ENTRY(pa, acl, pe) \
for(pa=(acl)->a_entries, pe=pa+(acl)->a_count; pa<pe; pa++)
/*
* Duplicate an ACL handle.
*/
static inline struct posix_acl *
posix_acl_dup(struct posix_acl *acl)
{
if (acl)
refcount_inc(&acl->a_refcount);
return acl;
}
/*
* Free an ACL handle.
*/
static inline void
posix_acl_release(struct posix_acl *acl)
{
if (acl && refcount_dec_and_test(&acl->a_refcount))
kfree_rcu(acl, a_rcu);
}
/* posix_acl.c */
extern void posix_acl_init(struct posix_acl *, int);
extern struct posix_acl *posix_acl_alloc(int, gfp_t);
extern int posix_acl_valid(struct user_namespace *, const struct posix_acl *);
extern int posix_acl_permission(struct inode *, const struct posix_acl *, int);
extern struct posix_acl *posix_acl_from_mode(umode_t, gfp_t);
extern int posix_acl_equiv_mode(const struct posix_acl *, umode_t *);
extern int __posix_acl_create(struct posix_acl **, gfp_t, umode_t *);
extern int __posix_acl_chmod(struct posix_acl **, gfp_t, umode_t);
extern struct posix_acl *get_posix_acl(struct inode *, int);
extern int set_posix_acl(struct inode *, int, struct posix_acl *);
#ifdef CONFIG_FS_POSIX_ACL
extern int posix_acl_chmod(struct inode *, umode_t);
extern int posix_acl_create(struct inode *, umode_t *, struct posix_acl **,
struct posix_acl **);
extern int posix_acl_update_mode(struct inode *, umode_t *, struct posix_acl **);
extern int simple_set_acl(struct inode *, struct posix_acl *, int);
extern int simple_acl_create(struct inode *, struct inode *);
struct posix_acl *get_cached_acl(struct inode *inode, int type);
struct posix_acl *get_cached_acl_rcu(struct inode *inode, int type);
void set_cached_acl(struct inode *inode, int type, struct posix_acl *acl);
void forget_cached_acl(struct inode *inode, int type);
void forget_all_cached_acls(struct inode *inode);
static inline void cache_no_acl(struct inode *inode)
{
inode->i_acl = NULL;
inode->i_default_acl = NULL;
}
#else
static inline int posix_acl_chmod(struct inode *inode, umode_t mode)
{
return 0;
}
#define simple_set_acl NULL
static inline int simple_acl_create(struct inode *dir, struct inode *inode)
{
return 0;
}
static inline void cache_no_acl(struct inode *inode)
{
}
static inline int posix_acl_create(struct inode *inode, umode_t *mode,
struct posix_acl **default_acl, struct posix_acl **acl)
{
*default_acl = *acl = NULL;
return 0;
}
static inline void forget_all_cached_acls(struct inode *inode)
{
}
#endif /* CONFIG_FS_POSIX_ACL */
struct posix_acl *get_acl(struct inode *inode, int type);
#endif /* __LINUX_POSIX_ACL_H */