[Top] [All Lists]

Re: [PATCH 1/4] fs: Improve filesystem freezing handling

To: Jan Kara <jack@xxxxxxx>
Subject: Re: [PATCH 1/4] fs: Improve filesystem freezing handling
From: Dave Chinner <david@xxxxxxxxxxxxx>
Date: Fri, 13 Jan 2012 12:26:43 +1100
Cc: linux-fsdevel@xxxxxxxxxxxxxxx, Surbhi Palande <csurbhi@xxxxxxxxx>, Kamal Mostafa <kamal@xxxxxxxxxxxxx>, Eric Sandeen <sandeen@xxxxxxxxxxx>, LKML <linux-kernel@xxxxxxxxxxxxxxx>, xfs@xxxxxxxxxxx, Christoph Hellwig <hch@xxxxxxxxxxxxx>, Dave Chinner <dchinner@xxxxxxxxxx>, linux-ext4@xxxxxxxxxxxxxxx
In-reply-to: <1326331253-6497-2-git-send-email-jack@xxxxxxx>
References: <1326331253-6497-1-git-send-email-jack@xxxxxxx> <1326331253-6497-2-git-send-email-jack@xxxxxxx>
User-agent: Mutt/1.5.21 (2010-09-15)
On Thu, Jan 12, 2012 at 02:20:50AM +0100, Jan Kara wrote:
> + *
> + * Decrement number of writers to the filesystem and wake up possible
> + * waiters wanting to freeze the filesystem.
> + */
> +void sb_end_write(struct super_block *sb)
> +{
> +#ifdef CONFIG_SMP
> +     this_cpu_dec(sb->s_writers);
> +#else
> +     preempt_disable();
> +     sb->s_writers--;
> +     preempt_enable();
> +#endif

I really dislike this type of open coded per-cpu counter
implementation. I can't see that there is no good reason to use it
over percpu_counters here which abstract all this mess away.

i.e. it is relatively rare that the per-cpu count will nest
greater than the percpu_counter batch size (needs more than 32
concurrent blocked active writes per CPU), so there is no
significant overhead to using the percpu_counters here.

Indeed, if there are that many blocked writes per CPU, then the
overhead of an occasional global counter update is going to be lost
in the noise of everything else that is going on.


Dave Chinner

<Prev in Thread] Current Thread [Next in Thread>