From patchwork Tue Jul 7 06:59:02 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Pranay Kr. Srivastava" X-Patchwork-Id: 6730361 Return-Path: X-Original-To: patchwork-linux-fsdevel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id DA291C05AC for ; Tue, 7 Jul 2015 06:59:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 050C620734 for ; Tue, 7 Jul 2015 06:59:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D228720732 for ; Tue, 7 Jul 2015 06:59:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753097AbbGGG7g (ORCPT ); Tue, 7 Jul 2015 02:59:36 -0400 Received: from mail-pa0-f47.google.com ([209.85.220.47]:33619 "EHLO mail-pa0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751041AbbGGG7f (ORCPT ); Tue, 7 Jul 2015 02:59:35 -0400 Received: by pacws9 with SMTP id ws9so109777814pac.0; Mon, 06 Jul 2015 23:59:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=G1RBYcgZGdimC4RxlwzHU2Zgo7YiQQNnrL7BRikLLAU=; b=BiWjUwCjhBkzWSWPz+CrdeWc15QxX6rTc+hYDjYacB2csI6MfBu/EBLEnLUf7nntH8 Ketmq5EVjIhPKMKi/7cO0du8fXvhySW5KvWkmL5/e6L+9J5ayY2qTrE+SNGbporbQaoI FbJ55EcskReJDqyzuHYidESAsDCZ/GJJEXxmh1MxQbBoSZ4xjta31LE/hiQ/XEgPphbJ k0eoPJau7g9g29gEXk1JIXDvNFklcwxV5LjRaD9VwdAa5EqB5qRSscmS/SKasC8HBeop dwZPKK+XH8B4TYu1EZh3dZCMLkx3rcZWRl+xKyyjA90ijVO0GM+p3DHJYH6o7bIikrBk WjuA== X-Received: by 10.70.42.13 with SMTP id j13mr5832144pdl.90.1436252375200; Mon, 06 Jul 2015 23:59:35 -0700 (PDT) Received: from pranays-pc.noida.itaas.com ([115.111.174.46]) by mx.google.com with ESMTPSA id sx5sm20757585pab.4.2015.07.06.23.59.31 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 06 Jul 2015 23:59:33 -0700 (PDT) From: "Pranay Kr. Srivastava" To: zippel@linux-m68k.org, akpm@linux-foundation.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Cc: "Pranay Kr. Srivastava" Subject: [PATCH] make affs root lookup from blkdev logical size Date: Tue, 7 Jul 2015 12:29:02 +0530 Message-Id: <1436252342-1643-1-git-send-email-pranjas@gmail.com> X-Mailer: git-send-email 1.7.9.5 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_WEB, RP_MATCHES_RCVD, T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch resolves Bug 16531. When logical blkdev size > 512 then sector numbers become larger than the device can support. Make affs start lookup based on the device's logical sector size instead of 512. Reported By: Mark Fix Suggessted By: Mark --- fs/affs/super.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/fs/affs/super.c b/fs/affs/super.c index 3f89c9e..5b50c4c 100644 --- a/fs/affs/super.c +++ b/fs/affs/super.c @@ -18,6 +18,7 @@ #include #include #include +#include #include "affs.h" static int affs_statfs(struct dentry *dentry, struct kstatfs *buf); @@ -352,18 +353,19 @@ static int affs_fill_super(struct super_block *sb, void *data, int silent) * blocks, we will have to change it. */ - size = sb->s_bdev->bd_inode->i_size >> 9; + size = i_size_read(sb->s_bdev->bd_inode) >> 9; pr_debug("initial blocksize=%d, #blocks=%d\n", 512, size); affs_set_blocksize(sb, PAGE_SIZE); /* Try to find root block. Its location depends on the block size. */ - i = 512; - j = 4096; + i = bdev_logical_block_size(sb->s_bdev); + j = PAGE_SIZE; if (blocksize > 0) { i = j = blocksize; size = size / (blocksize / 512); } + for (blocksize = i; blocksize <= j; blocksize <<= 1, size >>= 1) { sbi->s_root_block = root_block; if (root_block < 0)