Return-Path: Received: from mx2.suse.de ([195.135.220.15]:57403 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752236AbdHQQ60 (ORCPT ); Thu, 17 Aug 2017 12:58:26 -0400 Date: Thu, 17 Aug 2017 18:58:23 +0200 From: Jan Kara To: Andreas Dilger Cc: Jan Kara , linux-fsdevel@vger.kernel.org, Wang Shilong Subject: Re: [PATCH 02/27] quota: Do more fine-grained locking in dquot_acquire() Message-ID: <20170817165823.GD28850@quack2.suse.cz> References: <20170816154127.7048-1-jack@suse.cz> <20170816154127.7048-3-jack@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Wed 16-08-17 10:35:48, Andreas Dilger wrote: > On Aug 16, 2017, at 9:41 AM, Jan Kara wrote: > > > > We need dqio_sem held just for reading when calling ->read_dqblk() in > > dquot_acquire(). Also dqio_sem is not needed when manipulating dquot > > flags (those are protected by dq_lock) > > Nothing against the patch itself, but this comment is a bit confusing. > > It would be good to list this dq_lock dependency at the dq_flags declaration. > Looking through the code that accesses dq_flags, I see dquot_mark_dquot_dirty(), > clear_dquot_dirty(), dquot_commit(), dqput() depend on dq_list_lock, but > I don't see many of the users besides dquot_acquire() and dquot_release() > getting dq_lock, only using the atomic bit operations on dq_flags. Updated changelog to: We need dqio_sem held just for reading when calling ->read_dqblk() in dquot_acquire(). Also dqio_sem is not needed when setting DQ_READ_B and DQ_ACTIVE_B as concurrent reads and dquot activation are serialized by dq_lock. So acquire and release dqio_sem closer to the place where it is needed. This reduces lock hold time and will make locking changes easier. Honza -- Jan Kara SUSE Labs, CR