From patchwork Tue Dec 10 16:24:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Axboe X-Patchwork-Id: 11282953 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E0059188B for ; Tue, 10 Dec 2019 16:25:05 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 96B8C21D7D for ; Tue, 10 Dec 2019 16:25:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=kernel-dk.20150623.gappssmtp.com header.i=@kernel-dk.20150623.gappssmtp.com header.b="KdJPrK92" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 96B8C21D7D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.dk Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 4A99D6B2D39; Tue, 10 Dec 2019 11:25:02 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 459E36B2D3A; Tue, 10 Dec 2019 11:25:02 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3245E6B2D3B; Tue, 10 Dec 2019 11:25:02 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0207.hostedemail.com [216.40.44.207]) by kanga.kvack.org (Postfix) with ESMTP id 1DB626B2D39 for ; Tue, 10 Dec 2019 11:25:02 -0500 (EST) Received: from smtpin28.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with SMTP id 93B668249980 for ; Tue, 10 Dec 2019 16:25:01 +0000 (UTC) X-FDA: 76249756002.28.vein88_eb95daab5e1c X-Spam-Summary: 2,0,0,04c5fd9d861515ca,d41d8cd98f00b204,axboe@kernel.dk,::linux-fsdevel@vger.kernel.org:linux-block@vger.kernel.org:axboe@kernel.dk,RULES_HIT:41:355:379:541:800:960:973:988:989:1260:1311:1314:1345:1359:1431:1437:1515:1535:1544:1711:1730:1747:1777:1792:2194:2199:2393:2559:2562:3138:3139:3140:3141:3142:3355:3865:3866:3867:3868:3870:3871:4117:4321:4605:5007:6261:6653:10004:11026:11658:11914:12043:12114:12296:12297:12438:12517:12519:12555:12679:12895:12986:13868:13894:14096:14181:14394:14721:21080:21444:21611:21627:21796:21990:30034:30036:30046:30054,0,RBL:209.85.166.65:@kernel.dk:.lbl8.mailshell.net-62.2.0.100 66.100.201.201,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:26,LUA_SUMMARY:none X-HE-Tag: vein88_eb95daab5e1c X-Filterd-Recvd-Size: 6971 Received: from mail-io1-f65.google.com (mail-io1-f65.google.com [209.85.166.65]) by imf32.hostedemail.com (Postfix) with ESMTP for ; Tue, 10 Dec 2019 16:25:01 +0000 (UTC) Received: by mail-io1-f65.google.com with SMTP id t26so7991055ioi.13 for ; Tue, 10 Dec 2019 08:25:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=2SQjS8rVUv97zNNTlgrJhbpMsmZd4fG/GoKGJP3eAKE=; b=KdJPrK92FyMA/n5MuNfAlPHd0oImSTZlalWyF+0fuBSmXkKu6+diP7+rdBUbGQpZkk 7JPPl86po9n4aQWQLulc8QiRtO0Sp/qDEcuDRd5TS3VvNXvwp6XS/k+pfbmLHDxWl2f+ AAKVBkYYp9wj6E26MnzpxXrurr2jWtRi0TKky9UukdjDoA7/GdXM6YtsmCFoJ2+Mmr4I XbBcEuaesRjidUVjkNZj6QnpApK1tyWIMPyHHOG7cykF3oHdn2wyrzrk0JwXwBC10ZG8 YNj/QjZkJrssiZZ4EG+YJDYt62y/slOIEv53rD8vHwtBEUZjxJpCV8Qo1jklJy+34ySs iP1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=2SQjS8rVUv97zNNTlgrJhbpMsmZd4fG/GoKGJP3eAKE=; b=K36KpfNMdaZjV/E5M24LSja3/lEKJTDLnqRzNkjoC+mUfLA+R0uCfirpDqTPd6IVEf SKNLK5+WXO5adVFEq1EX+6kdwGTA5du4MClx2OJYFQ4hWlHQcXiaUKGTKm80zHcQz30w 0x1lHTFOpPV++0Ddv5Wwk4c5WQaktOG8UIBwUSuQWCMn8H4ax223VfU7q7S/yLoiW7Wi bY0DMllxmtfSub2O6HxTK/p1/R5mhIgAbUL/zjGx/wH9KY0OPSm+xvbngA9xMqWXB0XS QBmXFG/DOX7ktpWhCC+6MXGvVRKFADDzZyoiflzRTSY+8m3PyQwVakNuAyUFcZ4aoeu3 McCw== X-Gm-Message-State: APjAAAXPIFxMXWLYpzVcvEP92ehTrYnUXw6n2djnwt3aQ5AAZuWCnSEK Tlf9ikj1CkaUZeEzOj3uWq6xEVeyL7rJXQ== X-Google-Smtp-Source: APXvYqxLMClXfOrpqdQ+I1lUcEUYXE4y9owWqZYlmjE/yWxjL77FymqW+NlU+FpfZbH+AHoKbGInYA== X-Received: by 2002:a5e:d617:: with SMTP id w23mr25169022iom.98.1575995099536; Tue, 10 Dec 2019 08:24:59 -0800 (PST) Received: from x1.thefacebook.com ([65.144.74.34]) by smtp.gmail.com with ESMTPSA id y11sm791174iol.23.2019.12.10.08.24.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2019 08:24:58 -0800 (PST) From: Jens Axboe To: linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org Cc: Jens Axboe Subject: [PATCH 2/5] mm: make generic_perform_write() take a struct kiocb Date: Tue, 10 Dec 2019 09:24:51 -0700 Message-Id: <20191210162454.8608-3-axboe@kernel.dk> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191210162454.8608-1-axboe@kernel.dk> References: <20191210162454.8608-1-axboe@kernel.dk> MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Right now all callers pass in iocb->ki_pos, just pass in the iocb. This is in preparation for using the iocb flags in generic_perform_write(). Signed-off-by: Jens Axboe --- fs/ceph/file.c | 2 +- fs/ext4/file.c | 2 +- fs/nfs/file.c | 2 +- include/linux/fs.h | 3 ++- mm/filemap.c | 8 +++++--- 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/fs/ceph/file.c b/fs/ceph/file.c index 11929d2bb594..096c009f188f 100644 --- a/fs/ceph/file.c +++ b/fs/ceph/file.c @@ -1538,7 +1538,7 @@ static ssize_t ceph_write_iter(struct kiocb *iocb, struct iov_iter *from) * are pending vmtruncate. So write and vmtruncate * can not run at the same time */ - written = generic_perform_write(file, from, pos); + written = generic_perform_write(file, from, iocb); if (likely(written >= 0)) iocb->ki_pos = pos + written; ceph_end_io_write(inode); diff --git a/fs/ext4/file.c b/fs/ext4/file.c index 6a7293a5cda2..9ffb857765d5 100644 --- a/fs/ext4/file.c +++ b/fs/ext4/file.c @@ -249,7 +249,7 @@ static ssize_t ext4_buffered_write_iter(struct kiocb *iocb, goto out; current->backing_dev_info = inode_to_bdi(inode); - ret = generic_perform_write(iocb->ki_filp, from, iocb->ki_pos); + ret = generic_perform_write(iocb->ki_filp, from, iocb); current->backing_dev_info = NULL; out: diff --git a/fs/nfs/file.c b/fs/nfs/file.c index 8eb731d9be3e..d8f51a702a4e 100644 --- a/fs/nfs/file.c +++ b/fs/nfs/file.c @@ -624,7 +624,7 @@ ssize_t nfs_file_write(struct kiocb *iocb, struct iov_iter *from) result = generic_write_checks(iocb, from); if (result > 0) { current->backing_dev_info = inode_to_bdi(inode); - result = generic_perform_write(file, from, iocb->ki_pos); + result = generic_perform_write(file, from, iocb); current->backing_dev_info = NULL; } nfs_end_io_write(inode); diff --git a/include/linux/fs.h b/include/linux/fs.h index 092ea2a4319b..bf58db1bc032 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -3103,7 +3103,8 @@ extern ssize_t generic_file_read_iter(struct kiocb *, struct iov_iter *); extern ssize_t __generic_file_write_iter(struct kiocb *, struct iov_iter *); extern ssize_t generic_file_write_iter(struct kiocb *, struct iov_iter *); extern ssize_t generic_file_direct_write(struct kiocb *, struct iov_iter *); -extern ssize_t generic_perform_write(struct file *, struct iov_iter *, loff_t); +extern ssize_t generic_perform_write(struct file *, struct iov_iter *, + struct kiocb *); ssize_t vfs_iter_read(struct file *file, struct iov_iter *iter, loff_t *ppos, rwf_t flags); diff --git a/mm/filemap.c b/mm/filemap.c index ed23a11b3e34..fe37bd2b2630 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -3302,10 +3302,11 @@ struct page *grab_cache_page_write_begin(struct address_space *mapping, EXPORT_SYMBOL(grab_cache_page_write_begin); ssize_t generic_perform_write(struct file *file, - struct iov_iter *i, loff_t pos) + struct iov_iter *i, struct kiocb *iocb) { struct address_space *mapping = file->f_mapping; const struct address_space_operations *a_ops = mapping->a_ops; + loff_t pos = iocb->ki_pos; long status = 0; ssize_t written = 0; unsigned int flags = 0; @@ -3439,7 +3440,8 @@ ssize_t __generic_file_write_iter(struct kiocb *iocb, struct iov_iter *from) if (written < 0 || !iov_iter_count(from) || IS_DAX(inode)) goto out; - status = generic_perform_write(file, from, pos = iocb->ki_pos); + pos = iocb->ki_pos; + status = generic_perform_write(file, from, iocb); /* * If generic_perform_write() returned a synchronous error * then we want to return the number of bytes which were @@ -3471,7 +3473,7 @@ ssize_t __generic_file_write_iter(struct kiocb *iocb, struct iov_iter *from) */ } } else { - written = generic_perform_write(file, from, iocb->ki_pos); + written = generic_perform_write(file, from, iocb); if (likely(written > 0)) iocb->ki_pos += written; }