From patchwork Thu Aug 16 10:02:21 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marco Stornelli X-Patchwork-Id: 177942 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 82FB02C0092 for ; Thu, 16 Aug 2012 20:08:54 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755590Ab2HPKIv (ORCPT ); Thu, 16 Aug 2012 06:08:51 -0400 Received: from mail-we0-f174.google.com ([74.125.82.174]:41094 "EHLO mail-we0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752816Ab2HPKIu (ORCPT ); Thu, 16 Aug 2012 06:08:50 -0400 Received: by weyx8 with SMTP id x8so1615078wey.19 for ; Thu, 16 Aug 2012 03:08:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; bh=d2j8wK6k/c0ar04lEaBvIg9+qOzmNDZyfqO8cGPtgOw=; b=KYM1HKwfelQ0DlQw8sj1G6ijrow9YdwA7+Ova3SkzLXhBwETPLnG/QF4XajKMaME0Q p+GeCQ9QPCVol6sxHOphtfO8WrA5pKWWzuGkrEK1c+nIFDp76SvuWdPTiFdQCFIToXEf OByEpwqpbrnmEX28DpWjhPYK44q7xqBdSNGRnyedXdf7fYaIApHEXR3SPnthrHo9JnG4 pDc21vvm/boqFDlBR1P8YWzr5FUc03vK9VgI8ujQ0NQ0GP8Ewr7Dhmk4IdsMGCns2nXy TR5HHPVxhTrabLlikPrMw8M4fmLrM+6SUKVp4r/BwNXtqdFtVh8kwHlaOx5QrlHpwoKq a1vw== Received: by 10.180.78.4 with SMTP id x4mr4721507wiw.19.1345111728510; Thu, 16 Aug 2012 03:08:48 -0700 (PDT) Received: from [80.183.114.242] (host242-114-dynamic.183-80-r.retail.telecomitalia.it. [80.183.114.242]) by mx.google.com with ESMTPS id t8sm3049721wiy.3.2012.08.16.03.08.43 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 16 Aug 2012 03:08:48 -0700 (PDT) Message-ID: <502CC52D.20003@gmail.com> Date: Thu, 16 Aug 2012 12:02:21 +0200 From: Marco Stornelli User-Agent: Mozilla/5.0 (X11; Linux i686; rv:13.0) Gecko/20120601 Thunderbird/13.0 MIME-Version: 1.0 To: bharrosh@panasas.com, bhalevy@tonian.com, jack@suse.cz, Andrew Morton , adilger.kernel@dilger.ca, tytso@mit.edu, hirofumi@mail.parknet.co.jp, mikulas@artax.karlin.mff.cuni.cz, Al Viro , hch@infradead.org, dushistov@mail.ru, osd-dev@open-osd.org, Linux Kernel , linux-ext4@vger.kernel.org, Linux FS Devel Subject: [PATCH 4/8] ext4: remove lock/unlock super Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Marco Stornelli Replaced lock and unlock super with a new fs mutex s_lock. Signed-off-by: Marco Stornelli --- -- To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff -Nurp linux-3.6-rc1-orig/fs/ext4/ext4.h linux-3.6-rc1/fs/ext4/ext4.h --- linux-3.6-rc1-orig/fs/ext4/ext4.h 2012-08-16 09:37:31.000000000 +0200 +++ linux-3.6-rc1/fs/ext4/ext4.h 2012-08-16 09:50:40.000000000 +0200 @@ -1293,6 +1293,8 @@ struct ext4_sb_info { /* Reference to checksum algorithm driver via cryptoapi */ struct crypto_shash *s_chksum_driver; + struct mutex s_lock; + /* Precomputed FS UUID checksum for seeding other checksums */ __u32 s_csum_seed; }; diff -Nurp linux-3.6-rc1-orig/fs/ext4/super.c linux-3.6-rc1/fs/ext4/super.c --- linux-3.6-rc1-orig/fs/ext4/super.c 2012-08-16 09:37:32.000000000 +0200 +++ linux-3.6-rc1/fs/ext4/super.c 2012-08-16 09:54:30.000000000 +0200 @@ -861,7 +861,7 @@ static void ext4_put_super(struct super_ flush_workqueue(sbi->dio_unwritten_wq); destroy_workqueue(sbi->dio_unwritten_wq); - lock_super(sb); + mutex_lock(&sbi->s_lock); if (sbi->s_journal) { err = jbd2_journal_destroy(sbi->s_journal); sbi->s_journal = NULL; @@ -928,7 +928,7 @@ static void ext4_put_super(struct super_ * Now that we are completely done shutting down the * superblock, we need to actually destroy the kobject. */ - unlock_super(sb); + mutex_unlock(&sbi->s_lock); kobject_put(&sbi->s_kobj); wait_for_completion(&sbi->s_kobj_unregister); if (sbi->s_chksum_driver) @@ -3718,6 +3718,7 @@ static int ext4_fill_super(struct super_ sbi->s_gdb_count = db_count; get_random_bytes(&sbi->s_next_generation, sizeof(u32)); spin_lock_init(&sbi->s_next_gen_lock); + mutex_init(&sbi->s_lock); init_timer(&sbi->s_err_report); sbi->s_err_report.function = print_daily_error_info; @@ -4519,11 +4520,11 @@ static int ext4_unfreeze(struct super_bl if (sb->s_flags & MS_RDONLY) return 0; - lock_super(sb); + mutex_lock(&EXT4_SB(sb)->s_lock); /* Reset the needs_recovery flag before the fs is unlocked. */ EXT4_SET_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_RECOVER); ext4_commit_super(sb, 1); - unlock_super(sb); + mutex_unlock(&EXT4_SB(sb)->s_lock); return 0; } @@ -4559,7 +4560,7 @@ static int ext4_remount(struct super_blo char *orig_data = kstrdup(data, GFP_KERNEL); /* Store the original options */ - lock_super(sb); + mutex_lock(&sbi->s_lock); old_sb_flags = sb->s_flags; old_opts.s_mount_opt = sbi->s_mount_opt; old_opts.s_mount_opt2 = sbi->s_mount_opt2; @@ -4701,7 +4702,7 @@ static int ext4_remount(struct super_blo if (sbi->s_journal == NULL) ext4_commit_super(sb, 1); - unlock_super(sb); + mutex_unlock(&sbi->s_lock); #ifdef CONFIG_QUOTA /* Release old quota file names */ for (i = 0; i < MAXQUOTAS; i++) @@ -4715,7 +4716,7 @@ static int ext4_remount(struct super_blo EXT4_FEATURE_RO_COMPAT_QUOTA)) { err = ext4_enable_quotas(sb); if (err) { - lock_super(sb); + mutex_lock(&sbi->s_lock); goto restore_opts; } } @@ -4744,7 +4745,7 @@ restore_opts: sbi->s_qf_names[i] = old_opts.s_qf_names[i]; } #endif - unlock_super(sb); + mutex_unlock(&sbi->s_lock); kfree(orig_data); return err; }