From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.linuxfoundation.org ([140.211.169.12]:54340 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752365AbcLIUCv (ORCPT ); Fri, 9 Dec 2016 15:02:51 -0500 Date: Fri, 9 Dec 2016 12:03:27 -0800 From: Andrew Morton To: Fabian Frederick Cc: Alexander Viro , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH V2 linux-next] fs: add BLOCKSIZE(inode) Message-Id: <20161209120327.1e75aaf0cc4c250d0a80f6b9@linux-foundation.org> In-Reply-To: <1481312313-29680-1-git-send-email-fabf@skynet.be> References: <1481312313-29680-1-git-send-email-fabf@skynet.be> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Fri, 9 Dec 2016 20:38:33 +0100 Fabian Frederick wrote: > Add (1 << inode->i_blkbits) macro for more readability > #define BLOCKSIZE(inode) (1 << inode->i_blkbits) > > This patch also fixes multiple checkpatch warnings: > WARNING: Prefer 'unsigned int' to bare use of 'unsigned' > > ... > > --- a/include/linux/fs.h > +++ b/include/linux/fs.h > @@ -543,6 +543,7 @@ is_uncached_acl(struct posix_acl *acl) > #define IOP_LOOKUP 0x0002 > #define IOP_NOFOLLOW 0x0004 > #define IOP_XATTR 0x0008 > +#define BLOCKSIZE(inode) (1 << inode->i_blkbits) > > /* > * Keep mostly read-only and often accessed (especially for The name "BLOCKSIZE" is too generic. Why should inodes consume this identifier kernel-wide rather than, say, struct bio? The return type is `int', yes? I guess a 32-bit quantity is OK, but I don't see why it should be signed. So I'd suggest something along the lines of static inline unsigned i_blocksize(const struct inode *inode) { ... }