From patchwork Fri Jul 5 17:26:24 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sha Zhengju X-Patchwork-Id: 2824301 Return-Path: X-Original-To: patchwork-ceph-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id CC8D1BF4A1 for ; Fri, 5 Jul 2013 17:29:35 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E0A2620138 for ; Fri, 5 Jul 2013 17:29:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E7DB920134 for ; Fri, 5 Jul 2013 17:29:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932888Ab3GER3b (ORCPT ); Fri, 5 Jul 2013 13:29:31 -0400 Received: from mail-pd0-f179.google.com ([209.85.192.179]:50157 "EHLO mail-pd0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752249Ab3GER3a (ORCPT ); Fri, 5 Jul 2013 13:29:30 -0400 Received: by mail-pd0-f179.google.com with SMTP id q10so2164382pdj.38 for ; Fri, 05 Jul 2013 10:29:29 -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:x-mailer:in-reply-to:references; bh=/E0wcUeNuMmcUhbz6tKwCrm7MPjE1nF8NS2c2fDM9V4=; b=y/uDKV+EBGhyVsU8SbDvQ3A7JGLgCsAKCKbPDTAKfF7X+45TboyObLn1dgtZ0zEsS/ 7SKmGOWnMokP9PQref9uWQaI/V3N8Cg3g8A7vHcUvju2EVhau8FTcIgsAGW0o4nbAi3F ARgjTX3gqXLSJgVrEMOz0mLGZgDM2ugT3xYngfRxfTXljEbpfxNfKAJ8fZkHe6ZsqyTN eGTpA2c1XVxBjcAYv08rjk3etICmvIGtzGjU652zrumPJ3YAjyiQAIG7fAgoO0+zZuLd 0Y2ECD1lxlJWKAM1DEemsLbGSzAo2+f7h+hOBtnJ/tKE9GzaYpASgsMriXBM6XkDazIw pYXA== X-Received: by 10.68.27.105 with SMTP id s9mr10804454pbg.29.1373045369389; Fri, 05 Jul 2013 10:29:29 -0700 (PDT) Received: from localhost.localdomain ([123.119.96.144]) by mx.google.com with ESMTPSA id yj2sm8428414pbb.40.2013.07.05.10.29.23 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 05 Jul 2013 10:29:28 -0700 (PDT) From: Sha Zhengju To: linux-fsdevel@vger.kernel.org, ceph-devel@vger.kernel.org, linux-mm@kvack.org, cgroups@vger.kernel.org Cc: sage@inktank.com, mhocko@suse.cz, gthelen@google.com, kamezawa.hiroyu@jp.fujitsu.com, akpm@linux-foundation.org, fengguang.wu@intel.com, mgorman@suse.de, Sha Zhengju Subject: [PATCH V4 2/6] fs/ceph: vfs __set_page_dirty_nobuffers interface instead of doing it inside filesystem Date: Sat, 6 Jul 2013 01:26:24 +0800 Message-Id: <1373045184-27568-1-git-send-email-handai.szj@taobao.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1373044710-27371-1-git-send-email-handai.szj@taobao.com> References: <1373044710-27371-1-git-send-email-handai.szj@taobao.com> Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable 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 From: Sha Zhengju Following we will begin to add memcg dirty page accounting around __set_page_dirty_ {buffers,nobuffers} in vfs layer, so we'd better use vfs interface to avoid exporting those details to filesystems. Signed-off-by: Sha Zhengju cc: Sage Weil cc: Michal Hocko cc: Greg Thelen cc: KAMEZAWA Hiroyuki cc: Andrew Morton cc: Fengguang Wu cc: Mel Gorman --- fs/ceph/addr.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c index 3e68ac1..1445bf1 100644 --- a/fs/ceph/addr.c +++ b/fs/ceph/addr.c @@ -76,7 +76,7 @@ static int ceph_set_page_dirty(struct page *page) if (unlikely(!mapping)) return !TestSetPageDirty(page); - if (TestSetPageDirty(page)) { + if (!__set_page_dirty_nobuffers(page)) { dout("%p set_page_dirty %p idx %lu -- already dirty\n", mapping->host, page, page->index); return 0; @@ -107,14 +107,7 @@ static int ceph_set_page_dirty(struct page *page) snapc, snapc->seq, snapc->num_snaps); spin_unlock(&ci->i_ceph_lock); - /* now adjust page */ - spin_lock_irq(&mapping->tree_lock); if (page->mapping) { /* Race with truncate? */ - WARN_ON_ONCE(!PageUptodate(page)); - account_page_dirtied(page, page->mapping); - radix_tree_tag_set(&mapping->page_tree, - page_index(page), PAGECACHE_TAG_DIRTY); - /* * Reference snap context in page->private. Also set * PagePrivate so that we get invalidatepage callback. @@ -126,14 +119,10 @@ static int ceph_set_page_dirty(struct page *page) undo = 1; } - spin_unlock_irq(&mapping->tree_lock); - if (undo) /* whoops, we failed to dirty the page */ ceph_put_wrbuffer_cap_refs(ci, 1, snapc); - __mark_inode_dirty(mapping->host, I_DIRTY_PAGES); - BUG_ON(!PageDirty(page)); return 1; }