From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wj0-f175.google.com ([209.85.210.175]:33777 "EHLO mail-wj0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754072AbcLSVuL (ORCPT ); Mon, 19 Dec 2016 16:50:11 -0500 Received: by mail-wj0-f175.google.com with SMTP id xy5so160426049wjc.0 for ; Mon, 19 Dec 2016 13:50:10 -0800 (PST) Subject: Re: [RFC][PATCH 05/11] exofs: use common file type conversion To: Amir Goldstein , Jan Kara , Theodore Ts'o , Dave Chinner References: <1482178268-22883-1-git-send-email-amir73il@gmail.com> <1482178268-22883-6-git-send-email-amir73il@gmail.com> Cc: "Darrick J . Wong" , Chris Mason , Jaegeuk Kim , Ryusuke Konishi , Mark Fasheh , Evgeniy Dushistov , Miklos Szeredi , Al Viro , linux-fsdevel@vger.kernel.org From: Boaz Harrosh Message-ID: <38763b96-7759-f312-4762-b75a64c34044@plexistor.com> Date: Mon, 19 Dec 2016 23:50:07 +0200 MIME-Version: 1.0 In-Reply-To: <1482178268-22883-6-git-send-email-amir73il@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On 12/19/2016 10:11 PM, Amir Goldstein wrote: > deduplicate the exofs file type conversion implementation. > > Signed-off-by: Amir Goldstein Yes! thank you cool. ACK-by: Boaz Harrosh Al please take via your tree > --- > fs/exofs/common.h | 12 ------------ > fs/exofs/dir.c | 34 ++-------------------------------- > 2 files changed, 2 insertions(+), 44 deletions(-) > > diff --git a/fs/exofs/common.h b/fs/exofs/common.h > index 7d88ef5..917decc9 100644 > --- a/fs/exofs/common.h > +++ b/fs/exofs/common.h > @@ -204,18 +204,6 @@ struct exofs_dir_entry { > char name[EXOFS_NAME_LEN]; /* file name */ > }; > > -enum { > - EXOFS_FT_UNKNOWN, > - EXOFS_FT_REG_FILE, > - EXOFS_FT_DIR, > - EXOFS_FT_CHRDEV, > - EXOFS_FT_BLKDEV, > - EXOFS_FT_FIFO, > - EXOFS_FT_SOCK, > - EXOFS_FT_SYMLINK, > - EXOFS_FT_MAX > -}; > - > #define EXOFS_DIR_PAD 4 > #define EXOFS_DIR_ROUND (EXOFS_DIR_PAD - 1) > #define EXOFS_DIR_REC_LEN(name_len) \ > diff --git a/fs/exofs/dir.c b/fs/exofs/dir.c > index 42f9a0a..55fd31c 100644 > --- a/fs/exofs/dir.c > +++ b/fs/exofs/dir.c > @@ -203,33 +203,10 @@ exofs_validate_entry(char *base, unsigned offset, unsigned mask) > return (char *)p - base; > } > > -static unsigned char exofs_filetype_table[EXOFS_FT_MAX] = { > - [EXOFS_FT_UNKNOWN] = DT_UNKNOWN, > - [EXOFS_FT_REG_FILE] = DT_REG, > - [EXOFS_FT_DIR] = DT_DIR, > - [EXOFS_FT_CHRDEV] = DT_CHR, > - [EXOFS_FT_BLKDEV] = DT_BLK, > - [EXOFS_FT_FIFO] = DT_FIFO, > - [EXOFS_FT_SOCK] = DT_SOCK, > - [EXOFS_FT_SYMLINK] = DT_LNK, > -}; > - > -#define S_SHIFT 12 > -static unsigned char exofs_type_by_mode[S_IFMT >> S_SHIFT] = { > - [S_IFREG >> S_SHIFT] = EXOFS_FT_REG_FILE, > - [S_IFDIR >> S_SHIFT] = EXOFS_FT_DIR, > - [S_IFCHR >> S_SHIFT] = EXOFS_FT_CHRDEV, > - [S_IFBLK >> S_SHIFT] = EXOFS_FT_BLKDEV, > - [S_IFIFO >> S_SHIFT] = EXOFS_FT_FIFO, > - [S_IFSOCK >> S_SHIFT] = EXOFS_FT_SOCK, > - [S_IFLNK >> S_SHIFT] = EXOFS_FT_SYMLINK, > -}; > - > static inline > void exofs_set_de_type(struct exofs_dir_entry *de, struct inode *inode) > { > - umode_t mode = inode->i_mode; > - de->file_type = exofs_type_by_mode[(mode & S_IFMT) >> S_SHIFT]; > + de->file_type = fs_umode_to_ftype(inode->i_mode); > } > > static int > @@ -279,16 +256,9 @@ exofs_readdir(struct file *file, struct dir_context *ctx) > return -EIO; > } > if (de->inode_no) { > - unsigned char t; > - > - if (de->file_type < EXOFS_FT_MAX) > - t = exofs_filetype_table[de->file_type]; > - else > - t = DT_UNKNOWN; > - > if (!dir_emit(ctx, de->name, de->name_len, > le64_to_cpu(de->inode_no), > - t)) { > + fs_dtype(de->file_type))) { > exofs_put_page(page); > return 0; > } >