From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mulyadi Santosa Subject: Re: ext3 writing of data before metadata in ordered mode Date: Mon, 26 Oct 2009 11:40:39 +0700 Message-ID: References: <9ff7a3bc0910251433k2c719989n981e3652162cafdf@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: linux-fsdevel@vger.kernel.org, kernelnewbies To: Joel Fernandes Return-path: Received: from mail-pw0-f42.google.com ([209.85.160.42]:47230 "EHLO mail-pw0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751459AbZJZEky convert rfc822-to-8bit (ORCPT ); Mon, 26 Oct 2009 00:40:54 -0400 Received: by pwj9 with SMTP id 9so1110545pwj.21 for ; Sun, 25 Oct 2009 21:40:59 -0700 (PDT) In-Reply-To: <9ff7a3bc0910251433k2c719989n981e3652162cafdf@mail.gmail.com> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: Hi Joel... On Mon, Oct 26, 2009 at 4:33 AM, Joel Fernandes = wrote: > In data=3Dordered mode the ext3_ordered_commit_write function marks t= he > buffers as dirty, how then does the JBD ensure that the data is > written before the metadata? =A0Once the data buffers are marked as > dirty, JBD doesn't have control anymore over when the data is written > is actually written to disk right? Because the actually writing of th= e > data is handled by the page wtriteback mechanism (pdflush) right? I am not an expert, but here's my thought: I think writing to backing device is not done simply marking the buffer/page cache dirty. So, I think what kernel does is first prepare an I/O queue to update ext3 journal. Since we talk about data=3Dordered here, only metadata are logged. Perhaps the key here is, metadata writing is done as a async completion handler of data writing handler. Thus, data is written first, followed by metadata logging Another possibility is composing a single atomic I/O writing request, composed of data writing and metadata logging. Thus, I/O scheduler won't be able to re-order the request and must complete the sequence as we prepared. --=20 regards, Mulyadi Santosa =46reelance Linux trainer and consultant blog: the-hydra.blogspot.com training: mulyaditraining.blogspot.com -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel= " in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html