On Mon, Dec 16, 2013 at 02:33:11PM +0200, saeed bishara wrote:
> On Thu, Dec 12, 2013 at 1:38 AM, Chandra Seetharaman
> <sekharan@xxxxxxxxxx> wrote:
> > In order to handle a blocksize that is smaller than the
> > PAGE_SIZE, we need align all IOs to PAGE_SIZE.
> >
> > This patch defines a new macro btrfs_align_size() that
> > calculates the alignment size based on the sectorsize
> > and uses it at appropriate places.
> >
> > Signed-off-by: Chandra Seetharaman <sekharan@xxxxxxxxxx>
> > ---
> > fs/btrfs/btrfs_inode.h | 7 +++++++
> > fs/btrfs/compression.c | 3 ++-
> > fs/btrfs/extent-tree.c | 12 ++++++------
> > fs/btrfs/extent_io.c | 17 ++++++-----------
> > fs/btrfs/file.c | 15 +++++++--------
> > fs/btrfs/inode.c | 41 ++++++++++++++++++++++-------------------
> > fs/btrfs/ioctl.c | 6 +++---
> > fs/btrfs/ordered-data.c | 2 +-
> > fs/btrfs/tree-log.c | 2 +-
> > 9 files changed, 55 insertions(+), 50 deletions(-)
> >
> > diff --git a/fs/btrfs/btrfs_inode.h b/fs/btrfs/btrfs_inode.h
> > index ac0b39d..eee994f 100644
> > --- a/fs/btrfs/btrfs_inode.h
> > +++ b/fs/btrfs/btrfs_inode.h
> > @@ -280,4 +280,11 @@ static inline void btrfs_inode_resume_unlocked_dio(struct inode *inode)
> > &BTRFS_I(inode)->runtime_flags);
> > }
> >
> > +static inline u64 btrfs_align_size(struct inode *inode)
> > +{
> > + if (BTRFS_I(inode)->root->sectorsize < PAGE_CACHE_SIZE)
> > + return (u64)PAGE_CACHE_SIZE;
> > + else
> > + return (u64)BTRFS_I(inode)->root->sectorsize;
> > +}
> for performance, isn't it worth to store this value instead of
> calculating it each time?
I agree, would be better to add the corresponding item into fs_info,
initialized as proposed above.
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html