From patchwork Thu Apr 4 16:19:37 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 2393761 Return-Path: X-Original-To: patchwork-ceph-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 7EC72DF25A for ; Thu, 4 Apr 2013 16:19:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1763007Ab3DDQTk (ORCPT ); Thu, 4 Apr 2013 12:19:40 -0400 Received: from mail-ie0-f169.google.com ([209.85.223.169]:45863 "EHLO mail-ie0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1762972Ab3DDQTj (ORCPT ); Thu, 4 Apr 2013 12:19:39 -0400 Received: by mail-ie0-f169.google.com with SMTP id qd14so3235192ieb.14 for ; Thu, 04 Apr 2013 09:19:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:message-id:date:from:user-agent:mime-version:to:subject :references:in-reply-to:content-type:content-transfer-encoding :x-gm-message-state; bh=LANBcyzS/NaULvjIJVlOuyfKfKMod0W2JeUsgi1U47k=; b=N3IjfwD/RexfEL7JE4jYAvczGzjpSrPvV496zHuhfQxbn62Zt14RGRVKUq9iWXf/VW 2CWzccqFb/u9L4NVDBJyxsXINA1TBn+znMH1JDBTP0McW4nECkwQPNt+JF4ynhLjDcvr YFCrEQX7pWoVvoB6yUYgPsUiGw7ckZgf4iaOvxIyMS3fZE6b0lOT92/utbffsqB2ID9q EWxARBx5kM31Q72JlKLkEPP9Ov2Lh25v059v4S5hMlZMCWAsMAka8Gh9WPqIytmyaoyb rYUKFI9raH6zQDcglSsQP9mHJKq5tm8e4/83+FI3sFobOdJyS+3/0phYPrlknhwmSFnn gtCw== X-Received: by 10.50.236.42 with SMTP id ur10mr4227401igc.16.1365092378748; Thu, 04 Apr 2013 09:19:38 -0700 (PDT) Received: from [172.22.22.4] (c-71-195-31-37.hsd1.mn.comcast.net. [71.195.31.37]) by mx.google.com with ESMTPS id c14sm9824734ign.2.2013.04.04.09.19.37 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 04 Apr 2013 09:19:38 -0700 (PDT) Message-ID: <515DA819.4080204@inktank.com> Date: Thu, 04 Apr 2013 11:19:37 -0500 From: Alex Elder User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130308 Thunderbird/17.0.4 MIME-Version: 1.0 To: "ceph-devel@vger.kernel.org" Subject: [PATCH 6/9] ceph: define ceph_writepages_osd_request() References: <515DA755.2090504@inktank.com> In-Reply-To: <515DA755.2090504@inktank.com> X-Gm-Message-State: ALoCoQmIR4YKOfPwQUvWpZIUu+XhkXy1Ym1hkzSstAKWthXPgzkQBOZ0DdDE/jIA6nJltRieg6eg Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org Mostly for readability, define ceph_writepages_osd_request() and use it to allocate the osd request for ceph_writepages_start(). Signed-off-by: Alex Elder --- fs/ceph/addr.c | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c index de7aac0..5b4ac17 100644 --- a/fs/ceph/addr.c +++ b/fs/ceph/addr.c @@ -654,6 +654,26 @@ static void alloc_page_vec(struct ceph_fs_client *fsc, } } +static struct ceph_osd_request * +ceph_writepages_osd_request(struct inode *inode, u64 offset, u64 *len, + struct ceph_snap_context *snapc, + int num_ops, struct ceph_osd_req_op *ops) +{ + struct ceph_fs_client *fsc; + struct ceph_inode_info *ci; + struct ceph_vino vino; + + fsc = ceph_inode_to_client(inode); + ci = ceph_inode(inode); + vino = ceph_vino(inode); + /* BUG_ON(vino.snap != CEPH_NOSNAP); */ + + return ceph_osdc_new_request(&fsc->client->osdc, &ci->i_layout, + vino, offset, len, num_ops, ops, CEPH_OSD_OP_WRITE, + CEPH_OSD_FLAG_WRITE|CEPH_OSD_FLAG_ONDISK, + snapc, ci->i_truncate_seq, ci->i_truncate_size, true); +} + /* * initiate async writeback */ @@ -835,16 +855,9 @@ get_more_pages: /* prepare async write request */ offset = (u64) page_offset(page); len = wsize; - vino = ceph_vino(inode); - /* BUG_ON(vino.snap != CEPH_NOSNAP); */ - req = ceph_osdc_new_request(&fsc->client->osdc, - &ci->i_layout, vino, offset, &len, - num_ops, ops, - CEPH_OSD_OP_WRITE, - CEPH_OSD_FLAG_WRITE | - CEPH_OSD_FLAG_ONDISK, - snapc, ci->i_truncate_seq, - ci->i_truncate_size, true); + req = ceph_writepages_osd_request(inode, + offset, &len, snapc, + num_ops, ops); if (IS_ERR(req)) { rc = PTR_ERR(req); @@ -852,6 +865,7 @@ get_more_pages: break; } + vino = ceph_vino(inode); ceph_osdc_build_request(req, offset, num_ops, ops, snapc, vino.snap, &inode->i_mtime);