diff options
| author | Jaegeuk Kim <jaegeuk@kernel.org> | 2016-07-22 16:15:24 -0700 |
|---|---|---|
| committer | Mister Oyster <oysterized@gmail.com> | 2017-04-13 12:33:56 +0200 |
| commit | d55c7b5ef890389a19fa15fa58c796f5dd25f41f (patch) | |
| tree | ef8eb1ee14f7f58d9f146155c0931dd49398ccce /fs | |
| parent | 465ade03dd62ec1bd3718ee6b6762c32d8c1b701 (diff) | |
f2fs: adjust other changes
This patch changes:
- d_inode
- file_dentry
- inode_nohighmem
- ...
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs')
| -rw-r--r-- | fs/f2fs/Kconfig | 4 | ||||
| -rw-r--r-- | fs/f2fs/acl.c | 4 | ||||
| -rw-r--r-- | fs/f2fs/dir.c | 4 | ||||
| -rw-r--r-- | fs/f2fs/f2fs.h | 38 | ||||
| -rw-r--r-- | fs/f2fs/file.c | 22 | ||||
| -rw-r--r-- | fs/f2fs/inode.c | 1 | ||||
| -rw-r--r-- | fs/f2fs/namei.c | 21 | ||||
| -rw-r--r-- | fs/f2fs/xattr.c | 10 |
8 files changed, 61 insertions, 43 deletions
diff --git a/fs/f2fs/Kconfig b/fs/f2fs/Kconfig index 189eb5f81..378c221d6 100644 --- a/fs/f2fs/Kconfig +++ b/fs/f2fs/Kconfig @@ -21,10 +21,10 @@ config F2FS_STAT_FS depends on F2FS_FS && DEBUG_FS default y help - /sys/debug/f2fs/ contains information about all the partitions + /sys/kernel/debug/f2fs/ contains information about all the partitions mounted as f2fs. Each file shows the whole f2fs information. - /sys/debug/f2fs/status includes: + /sys/kernel/debug/f2fs/status includes: - major filesystem information managed by f2fs currently - average SIT information about whole segments - current memory footprint consumed by f2fs. diff --git a/fs/f2fs/acl.c b/fs/f2fs/acl.c index 57439fd40..18611da0c 100644 --- a/fs/f2fs/acl.c +++ b/fs/f2fs/acl.c @@ -359,7 +359,7 @@ static int f2fs_xattr_get_acl(struct dentry *dentry, const char *name, if (!test_opt(sbi, POSIX_ACL)) return -EOPNOTSUPP; - acl = f2fs_get_acl(dentry->d_inode, type); + acl = f2fs_get_acl(d_inode(dentry), type); if (IS_ERR(acl)) return PTR_ERR(acl); if (!acl) @@ -374,7 +374,7 @@ static int f2fs_xattr_set_acl(struct dentry *dentry, const char *name, const void *value, size_t size, int flags, int type) { struct f2fs_sb_info *sbi = F2FS_SB(dentry->d_sb); - struct inode *inode = dentry->d_inode; + struct inode *inode = d_inode(dentry); struct posix_acl *acl = NULL; int error; diff --git a/fs/f2fs/dir.c b/fs/f2fs/dir.c index 4b8b1357e..e4a0e23cb 100644 --- a/fs/f2fs/dir.c +++ b/fs/f2fs/dir.c @@ -219,8 +219,8 @@ static struct f2fs_dir_entry *find_in_level(struct inode *dir, * and the entry itself. Page is returned mapped and unlocked. * Entry is guaranteed to be valid. */ -struct f2fs_dir_entry *f2fs_find_entry(struct inode *dir, struct qstr *child, - struct page **res_page) +struct f2fs_dir_entry *f2fs_find_entry(struct inode *dir, + struct qstr *child, struct page **res_page) { unsigned long npages = dir_blocks(dir); struct f2fs_dir_entry *de = NULL; diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index cbdf51321..bb69ed12a 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -174,6 +174,21 @@ static inline bool wq_has_sleeper(wait_queue_head_t *wq) return waitqueue_active(wq); } +static inline struct inode *d_inode(const struct dentry *dentry) +{ + return dentry->d_inode; +} + +static inline struct dentry *file_dentry(const struct file *file) +{ + return file->f_path.dentry; +} + +static inline void inode_nohighmem(struct inode *inode) +{ + mapping_set_gfp_mask(inode->i_mapping, GFP_USER); +} + /* * For checkpoint manager */ @@ -290,15 +305,6 @@ static inline bool __has_cursum_space(struct f2fs_journal *journal, #define F2FS_IOC_GETFLAGS FS_IOC_GETFLAGS #define F2FS_IOC_SETFLAGS FS_IOC_SETFLAGS #define F2FS_IOC_GETVERSION FS_IOC_GETVERSION -#define FS_IOC_SHUTDOWN _IOR('X', 125, __u32) /* Shutdown */ - -/* - * Flags for going down operation used by FS_IOC_GOINGDOWN - */ -#define FS_GOING_DOWN_FULLSYNC 0x0 /* going down with full sync */ -#define FS_GOING_DOWN_METASYNC 0x1 /* going down with metadata */ -#define FS_GOING_DOWN_NOSYNC 0x2 /* going down */ -#define FS_GOING_DOWN_METAFLUSH 0x3 /* going down with meta flush */ #define F2FS_IOCTL_MAGIC 0xf5 #define F2FS_IOC_START_ATOMIC_WRITE _IO(F2FS_IOCTL_MAGIC, 1) @@ -316,6 +322,16 @@ static inline bool __has_cursum_space(struct f2fs_journal *journal, #define F2FS_IOC_GET_ENCRYPTION_POLICY FS_IOC_GET_ENCRYPTION_POLICY #define F2FS_IOC_GET_ENCRYPTION_PWSALT FS_IOC_GET_ENCRYPTION_PWSALT +/* + * should be same as XFS_IOC_GOINGDOWN. + * Flags for going down operation used by FS_IOC_GOINGDOWN + */ +#define F2FS_IOC_SHUTDOWN _IOR('X', 125, __u32) /* Shutdown */ +#define F2FS_GOING_DOWN_FULLSYNC 0x0 /* going down with full sync */ +#define F2FS_GOING_DOWN_METASYNC 0x1 /* going down with metadata */ +#define F2FS_GOING_DOWN_NOSYNC 0x2 /* going down */ +#define F2FS_GOING_DOWN_METAFLUSH 0x3 /* going down with meta flush */ + #if defined(__KERNEL__) && defined(CONFIG_COMPAT) /* * ioctl commands in 32 bit emulation @@ -1961,7 +1977,7 @@ void update_parent_metadata(struct inode *, struct inode *, unsigned int); int room_for_filename(const void *, int, int); void f2fs_drop_nlink(struct inode *, struct inode *); struct f2fs_dir_entry *f2fs_find_entry(struct inode *, struct qstr *, - struct page **); + struct page **); struct f2fs_dir_entry *f2fs_parent_dir(struct inode *, struct page **); ino_t f2fs_inode_by_name(struct inode *, struct qstr *, struct page **); void f2fs_set_link(struct inode *, struct f2fs_dir_entry *, @@ -1980,7 +1996,7 @@ bool f2fs_empty_dir(struct inode *); static inline int f2fs_add_link(struct dentry *dentry, struct inode *inode) { - return __f2fs_add_link(dentry->d_parent->d_inode, &dentry->d_name, + return __f2fs_add_link(d_inode(dentry->d_parent), &dentry->d_name, inode, inode->i_ino, inode->i_mode); } diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 43308e815..100594e3f 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -474,9 +474,9 @@ static int f2fs_file_open(struct inode *inode, struct file *filp) if (!fscrypt_has_encryption_key(inode)) return -ENOKEY; } - dir = dget_parent(filp->f_path.dentry); - if (f2fs_encrypted_inode(dir->d_inode) && - !fscrypt_has_permitted_context(dir->d_inode, inode)) { + dir = dget_parent(file_dentry(filp)); + if (f2fs_encrypted_inode(d_inode(dir)) && + !fscrypt_has_permitted_context(d_inode(dir), inode)) { dput(dir); return -EPERM; } @@ -659,7 +659,7 @@ int f2fs_truncate(struct inode *inode) int f2fs_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat) { - struct inode *inode = dentry->d_inode; + struct inode *inode = d_inode(dentry); generic_fillattr(inode, stat); stat->blocks <<= 3; return 0; @@ -697,7 +697,7 @@ static void __setattr_copy(struct inode *inode, const struct iattr *attr) int f2fs_setattr(struct dentry *dentry, struct iattr *attr) { - struct inode *inode = dentry->d_inode; + struct inode *inode = d_inode(dentry); int err; err = inode_change_ok(inode, attr); @@ -1707,22 +1707,22 @@ static int f2fs_ioc_shutdown(struct file *filp, unsigned long arg) return ret; switch (in) { - case FS_GOING_DOWN_FULLSYNC: + case F2FS_GOING_DOWN_FULLSYNC: sb = freeze_bdev(sb->s_bdev); if (sb && !IS_ERR(sb)) { f2fs_stop_checkpoint(sbi, false); thaw_bdev(sb->s_bdev, sb); } break; - case FS_GOING_DOWN_METASYNC: + case F2FS_GOING_DOWN_METASYNC: /* do checkpoint only */ f2fs_sync_fs(sb, 1); f2fs_stop_checkpoint(sbi, false); break; - case FS_GOING_DOWN_NOSYNC: + case F2FS_GOING_DOWN_NOSYNC: f2fs_stop_checkpoint(sbi, false); break; - case FS_GOING_DOWN_METAFLUSH: + case F2FS_GOING_DOWN_METAFLUSH: sync_meta_pages(sbi, META, LONG_MAX); f2fs_stop_checkpoint(sbi, false); break; @@ -2244,7 +2244,7 @@ long f2fs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) return f2fs_ioc_release_volatile_write(filp); case F2FS_IOC_ABORT_VOLATILE_WRITE: return f2fs_ioc_abort_volatile_write(filp); - case FS_IOC_SHUTDOWN: + case F2FS_IOC_SHUTDOWN: return f2fs_ioc_shutdown(filp, arg); case FITRIM: return f2fs_ioc_fitrim(filp, arg); @@ -2327,7 +2327,7 @@ long f2fs_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) case F2FS_IOC_START_VOLATILE_WRITE: case F2FS_IOC_RELEASE_VOLATILE_WRITE: case F2FS_IOC_ABORT_VOLATILE_WRITE: - case FS_IOC_SHUTDOWN: + case F2FS_IOC_SHUTDOWN: case F2FS_IOC_SET_ENCRYPTION_POLICY: case F2FS_IOC_GET_ENCRYPTION_PWSALT: case F2FS_IOC_GET_ENCRYPTION_POLICY: diff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c index e9c98acfd..7cb674725 100644 --- a/fs/f2fs/inode.c +++ b/fs/f2fs/inode.c @@ -214,6 +214,7 @@ make_now: inode->i_op = &f2fs_encrypted_symlink_inode_operations; else inode->i_op = &f2fs_symlink_inode_operations; + inode_nohighmem(inode); inode->i_mapping->a_ops = &f2fs_dblock_aops; } else if (S_ISCHR(inode->i_mode) || S_ISBLK(inode->i_mode) || S_ISFIFO(inode->i_mode) || S_ISSOCK(inode->i_mode)) { diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c index 223f89564..c24ba02c6 100644 --- a/fs/f2fs/namei.c +++ b/fs/f2fs/namei.c @@ -168,7 +168,7 @@ out: static int f2fs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry) { - struct inode *inode = old_dentry->d_inode; + struct inode *inode = d_inode(old_dentry); struct f2fs_sb_info *sbi = F2FS_I_SB(dir); int err; @@ -204,20 +204,20 @@ struct dentry *f2fs_get_parent(struct dentry *child) { struct qstr dotdot = QSTR_INIT("..", 2); struct page *page; - unsigned long ino = f2fs_inode_by_name(child->d_inode, &dotdot, &page); + unsigned long ino = f2fs_inode_by_name(d_inode(child), &dotdot, &page); if (!ino) { if (IS_ERR(page)) return ERR_CAST(page); return ERR_PTR(-ENOENT); } - return d_obtain_alias(f2fs_iget(child->d_inode->i_sb, ino)); + return d_obtain_alias(f2fs_iget(child->d_sb, ino)); } static int __recover_dot_dentries(struct inode *dir, nid_t pino) { struct f2fs_sb_info *sbi = F2FS_I_SB(dir); - struct qstr dot = {.len = 1, .name = "."}; - struct qstr dotdot = {.len = 2, .name = ".."}; + struct qstr dot = QSTR_INIT(".", 1); + struct qstr dotdot = QSTR_INIT("..", 2); struct f2fs_dir_entry *de; struct page *page; int err = 0; @@ -335,7 +335,7 @@ err_out: static int f2fs_unlink(struct inode *dir, struct dentry *dentry) { struct f2fs_sb_info *sbi = F2FS_I_SB(dir); - struct inode *inode = dentry->d_inode; + struct inode *inode = d_inode(dentry); struct f2fs_dir_entry *de; struct page *page; int err = -ENOENT; @@ -424,6 +424,7 @@ static int f2fs_symlink(struct inode *dir, struct dentry *dentry, inode->i_op = &f2fs_encrypted_symlink_inode_operations; else inode->i_op = &f2fs_symlink_inode_operations; + inode_nohighmem(inode); inode->i_mapping->a_ops = &f2fs_dblock_aops; f2fs_balance_fs(sbi, true); @@ -537,7 +538,7 @@ out_fail: static int f2fs_rmdir(struct inode *dir, struct dentry *dentry) { - struct inode *inode = dentry->d_inode; + struct inode *inode = d_inode(dentry); if (f2fs_empty_dir(inode)) return f2fs_unlink(dir, dentry); return -ENOTEMPTY; @@ -585,8 +586,8 @@ static int f2fs_rename(struct inode *old_dir, struct dentry *old_dentry, struct inode *new_dir, struct dentry *new_dentry) { struct f2fs_sb_info *sbi = F2FS_I_SB(old_dir); - struct inode *old_inode = old_dentry->d_inode; - struct inode *new_inode = new_dentry->d_inode; + struct inode *old_inode = d_inode(old_dentry); + struct inode *new_inode = d_inode(new_dentry); struct page *old_dir_page; struct page *old_page, *new_page; struct f2fs_dir_entry *old_dir_entry = NULL; @@ -749,7 +750,7 @@ static void *f2fs_encrypted_follow_link(struct dentry *dentry, struct fscrypt_str cstr = FSTR_INIT(NULL, 0); struct fscrypt_str pstr = FSTR_INIT(NULL, 0); struct fscrypt_symlink_data *sd; - struct inode *inode = dentry->d_inode; + struct inode *inode = d_inode(dentry); loff_t size = min_t(loff_t, i_size_read(inode), PAGE_SIZE - 1); u32 max_size = inode->i_sb->s_blocksize; int res; diff --git a/fs/f2fs/xattr.c b/fs/f2fs/xattr.c index f3da0feb0..d9dfe530b 100644 --- a/fs/f2fs/xattr.c +++ b/fs/f2fs/xattr.c @@ -82,7 +82,7 @@ static int f2fs_xattr_generic_get(struct dentry *dentry, const char *name, } if (strcmp(name, "") == 0) return -EINVAL; - return f2fs_getxattr(dentry->d_inode, type, name, buffer, size, NULL); + return f2fs_getxattr(d_inode(dentry), type, name, buffer, size, NULL); } static int f2fs_xattr_generic_set(struct dentry *dentry, const char *name, @@ -107,7 +107,7 @@ static int f2fs_xattr_generic_set(struct dentry *dentry, const char *name, if (strcmp(name, "") == 0) return -EINVAL; - return f2fs_setxattr(dentry->d_inode, type, name, + return f2fs_setxattr(d_inode(dentry), type, name, value, size, NULL, flags); } @@ -129,7 +129,7 @@ static size_t f2fs_xattr_advise_list(struct dentry *dentry, char *list, static int f2fs_xattr_advise_get(struct dentry *dentry, const char *name, void *buffer, size_t size, int type) { - struct inode *inode = dentry->d_inode; + struct inode *inode = d_inode(dentry); if (strcmp(name, "") != 0) return -EINVAL; @@ -142,7 +142,7 @@ static int f2fs_xattr_advise_get(struct dentry *dentry, const char *name, static int f2fs_xattr_advise_set(struct dentry *dentry, const char *name, const void *value, size_t size, int flags, int type) { - struct inode *inode = dentry->d_inode; + struct inode *inode = d_inode(dentry); if (strcmp(name, "") != 0) return -EINVAL; @@ -444,7 +444,7 @@ cleanup: ssize_t f2fs_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size) { - struct inode *inode = dentry->d_inode; + struct inode *inode = d_inode(dentry); struct f2fs_xattr_entry *entry; void *base_addr; int error = 0; |
