Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp3062554pxu; Mon, 19 Oct 2020 02:58:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxoG14oF1cVuccBVD41nwKPDIVMrJoY59GDcpq0WbrVR3VtA0F8f4+AEowtXkKIDHytUN7V X-Received: by 2002:a17:906:2dc5:: with SMTP id h5mr16298584eji.507.1603101535185; Mon, 19 Oct 2020 02:58:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603101535; cv=none; d=google.com; s=arc-20160816; b=yiSl9oXEBjFiC6WpzIjOcAGqgu6rr44jkjmXz10AiKN0oKM3cRIPFh1OcbYGBzHCfb dGLbxNeZZTTeldSpxCucN8X0B5Ao76aY9j33fULHlDJnNTg4VyD0HxJkEWWCIIrSls7d l2ZFYGCvhHVGbOiLgufq5NYHvXIwu1XL2bN9SQHPSKD+OEOBEglUvDYJQc3RBaHqtdW4 0RJ/aQpOv/QjQRaWHDtFYp+hVQauk7Aroqh7QTcdp6pzR5nz68t++CIgDOnQ7eB335EE x2qVRR2gc+zMEQpcQ4spMzNBltogZuZGtoowLIF/jmYvYgJUxDcfMirjbNLRP8+XXD0f sDTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=AXG6jOtPUaAkxpmExytpCYme+/qeZvBbz3J0v9qzZ18=; b=F6tfv1xQsz6sCWEghO51rmykzuTXp92Gy9AhcA+SqAUkj0dMBt602tSD/RFQXhsJnE CEPSmWx2JY3DbpblSopH3e0AqLQnXaBBznMNQLmxXNIQeTAG3gYvDc+6pZRHK55m0qPB HNJXrL0R4RZS0rA5Ex+JbaVypdtd1/32UJbj//ge+xdnTmQACS/ft4cVpB7LmjR4vKav 5eTLzKZHM2HsW7FSQBgExyJ1kwINHZFbMjPSr1JsQ4eAWPutBfuNIRNKPx4qzTHr65cA mnD6QRNUryw9Vjqs2iQlbrJt0dIW6sv6+QlTpQbuQQkTHmzWqsc2heiE43EVNLjptY11 mxyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=WFbGUJ2W; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id yz13si7397989ejb.173.2020.10.19.02.58.33; Mon, 19 Oct 2020 02:58:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=WFbGUJ2W; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729224AbgJSCGB (ORCPT + 99 others); Sun, 18 Oct 2020 22:06:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38286 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729096AbgJSCGA (ORCPT ); Sun, 18 Oct 2020 22:06:00 -0400 Received: from mail-pj1-x1044.google.com (mail-pj1-x1044.google.com [IPv6:2607:f8b0:4864:20::1044]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA816C061755; Sun, 18 Oct 2020 19:06:00 -0700 (PDT) Received: by mail-pj1-x1044.google.com with SMTP id a1so4729706pjd.1; Sun, 18 Oct 2020 19:06:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=AXG6jOtPUaAkxpmExytpCYme+/qeZvBbz3J0v9qzZ18=; b=WFbGUJ2WtIpW6DzyFTfmz8G71mi3rgYBhkpKIHhVP8B6oibcHbSzBAGJ/wyico5Xt9 VI9FVEuxOwe+aR4tHFCD4SP5/t8kZMULd3pN9wzb37QqsF4jguvrsNbzpvK7YdVBezZd 9hrMFG7YCotLyp4+tVCWGlThDnDUWetZpdBZd6dl3bM1mwtN5WIUkUNu+smslD9jKCot jFRfInrxefBRUxdH4GgVC+spJPgR7MEEne1dj6nEgpDB8MRavPG8v8ciH+39NvGAbhPg 8iO6TfkUhNvlPvRllJr2mre41lZIHXvg8XrRaczhqykk7Ud72+QrXWSkL4wVrGxcUMY4 y8kQ== 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:mime-version :content-transfer-encoding; bh=AXG6jOtPUaAkxpmExytpCYme+/qeZvBbz3J0v9qzZ18=; b=Zy8Dtc9PQmijoF5prAz23qrPj4u3Eq5Y05d2EP3HoSfJ+bNkjDq5Q09wBD30VNNw2G W/xeJzWRYXltwh5lif63DkHyi1wtfzKsZz7gEAxt1PDnclb1LjObkWFWWf/u/QDbnLRZ /jpFCx3/FzrUoVwGZnWSvO9NzNVnMK4b7Xkb6dfLaSZHlIuqJsUXITyQNhHAZlO4tSpz 4E8YdsWitNiXzgLItx72Rgcf1vdCHq46+ERqSTzyW4U8FVMZpjgEeqJIHbbzJtTQhGrk tNNwf5bEhHHRrwqBqvaRPRHxohZ8GN1eXLcs/AJnahPsJfSD+G1Z3ZXfLa7c27fg8k7A Vgkg== X-Gm-Message-State: AOAM531QmxMyE15aMc641A6L9ozvi9k+EVUNc3/tyIE27n32Z3cnAejL mJK+W5rhhNvrSKLI5c/Pnsk= X-Received: by 2002:a17:902:56e:b029:d5:d861:6b17 with SMTP id 101-20020a170902056eb02900d5d8616b17mr7330110plf.17.1603073160313; Sun, 18 Oct 2020 19:06:00 -0700 (PDT) Received: from dc803.localdomain (FL1-111-169-190-108.hyg.mesh.ad.jp. [111.169.190.108]) by smtp.gmail.com with ESMTPSA id y4sm9832891pgs.0.2020.10.18.19.05.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Oct 2020 19:05:59 -0700 (PDT) From: Tetsuhiro Kohada To: kohada.t2@gmail.com Cc: kohada.tetsuhiro@dc.mitsubishielectric.co.jp, mori.takahiro@ab.mitsubishielectric.co.jp, Namjae Jeon , Sungjong Seo , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 1/2] exfat: add exfat_update_inode() Date: Mon, 19 Oct 2020 11:05:53 +0900 Message-Id: <20201019020554.28619-1-kohada.t2@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Integrate exfat_sync_inode() and mark_inode_dirty() as exfat_update_inode() Also, return the result of _exfat_write_inode () when sync is specified. Signed-off-by: Tetsuhiro Kohada --- Changes in v4 - no change Changes in v3 - no change Changes in v2 - no change fs/exfat/exfat_fs.h | 2 +- fs/exfat/file.c | 5 +---- fs/exfat/inode.c | 9 +++++++-- fs/exfat/namei.c | 35 +++++++---------------------------- 4 files changed, 16 insertions(+), 35 deletions(-) diff --git a/fs/exfat/exfat_fs.h b/fs/exfat/exfat_fs.h index b8f0e829ecbd..ec0ee516aee2 100644 --- a/fs/exfat/exfat_fs.h +++ b/fs/exfat/exfat_fs.h @@ -466,7 +466,7 @@ int exfat_count_dir_entries(struct super_block *sb, struct exfat_chain *p_dir); /* inode.c */ extern const struct inode_operations exfat_file_inode_operations; -void exfat_sync_inode(struct inode *inode); +int exfat_update_inode(struct inode *inode); struct inode *exfat_build_inode(struct super_block *sb, struct exfat_dir_entry *info, loff_t i_pos); void exfat_hash_inode(struct inode *inode, loff_t i_pos); diff --git a/fs/exfat/file.c b/fs/exfat/file.c index a92478eabfa4..e510b95dbf77 100644 --- a/fs/exfat/file.c +++ b/fs/exfat/file.c @@ -245,10 +245,7 @@ void exfat_truncate(struct inode *inode, loff_t size) goto write_size; inode->i_ctime = inode->i_mtime = current_time(inode); - if (IS_DIRSYNC(inode)) - exfat_sync_inode(inode); - else - mark_inode_dirty(inode); + exfat_update_inode(inode); inode->i_blocks = ((i_size_read(inode) + (sbi->cluster_size - 1)) & ~(sbi->cluster_size - 1)) >> inode->i_blkbits; diff --git a/fs/exfat/inode.c b/fs/exfat/inode.c index 730373e0965a..5a55303e1f65 100644 --- a/fs/exfat/inode.c +++ b/fs/exfat/inode.c @@ -91,10 +91,15 @@ int exfat_write_inode(struct inode *inode, struct writeback_control *wbc) return ret; } -void exfat_sync_inode(struct inode *inode) +int exfat_update_inode(struct inode *inode) { lockdep_assert_held(&EXFAT_SB(inode->i_sb)->s_lock); - __exfat_write_inode(inode, 1); + + if (IS_DIRSYNC(inode)) + return __exfat_write_inode(inode, 1); + + mark_inode_dirty(inode); + return 0; } /* diff --git a/fs/exfat/namei.c b/fs/exfat/namei.c index 2932b23a3b6c..1f5f72eb5baf 100644 --- a/fs/exfat/namei.c +++ b/fs/exfat/namei.c @@ -561,10 +561,7 @@ static int exfat_create(struct inode *dir, struct dentry *dentry, umode_t mode, inode_inc_iversion(dir); dir->i_ctime = dir->i_mtime = current_time(dir); - if (IS_DIRSYNC(dir)) - exfat_sync_inode(dir); - else - mark_inode_dirty(dir); + exfat_update_inode(dir); i_pos = exfat_make_i_pos(&info); inode = exfat_build_inode(sb, &info, i_pos); @@ -812,10 +809,7 @@ static int exfat_unlink(struct inode *dir, struct dentry *dentry) inode_inc_iversion(dir); dir->i_mtime = dir->i_atime = current_time(dir); exfat_truncate_atime(&dir->i_atime); - if (IS_DIRSYNC(dir)) - exfat_sync_inode(dir); - else - mark_inode_dirty(dir); + exfat_update_inode(dir); clear_nlink(inode); inode->i_mtime = inode->i_atime = current_time(inode); @@ -846,10 +840,7 @@ static int exfat_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) inode_inc_iversion(dir); dir->i_ctime = dir->i_mtime = current_time(dir); - if (IS_DIRSYNC(dir)) - exfat_sync_inode(dir); - else - mark_inode_dirty(dir); + exfat_update_inode(dir); inc_nlink(dir); i_pos = exfat_make_i_pos(&info); @@ -976,10 +967,7 @@ static int exfat_rmdir(struct inode *dir, struct dentry *dentry) inode_inc_iversion(dir); dir->i_mtime = dir->i_atime = current_time(dir); exfat_truncate_atime(&dir->i_atime); - if (IS_DIRSYNC(dir)) - exfat_sync_inode(dir); - else - mark_inode_dirty(dir); + exfat_update_inode(dir); drop_nlink(dir); clear_nlink(inode); @@ -1347,19 +1335,13 @@ static int exfat_rename(struct inode *old_dir, struct dentry *old_dentry, new_dir->i_ctime = new_dir->i_mtime = new_dir->i_atime = EXFAT_I(new_dir)->i_crtime = current_time(new_dir); exfat_truncate_atime(&new_dir->i_atime); - if (IS_DIRSYNC(new_dir)) - exfat_sync_inode(new_dir); - else - mark_inode_dirty(new_dir); + exfat_update_inode(new_dir); i_pos = ((loff_t)EXFAT_I(old_inode)->dir.dir << 32) | (EXFAT_I(old_inode)->entry & 0xffffffff); exfat_unhash_inode(old_inode); exfat_hash_inode(old_inode, i_pos); - if (IS_DIRSYNC(new_dir)) - exfat_sync_inode(old_inode); - else - mark_inode_dirty(old_inode); + exfat_update_inode(old_inode); if (S_ISDIR(old_inode->i_mode) && old_dir != new_dir) { drop_nlink(old_dir); @@ -1369,10 +1351,7 @@ static int exfat_rename(struct inode *old_dir, struct dentry *old_dentry, inode_inc_iversion(old_dir); old_dir->i_ctime = old_dir->i_mtime = current_time(old_dir); - if (IS_DIRSYNC(old_dir)) - exfat_sync_inode(old_dir); - else - mark_inode_dirty(old_dir); + exfat_update_inode(old_dir); if (new_inode) { exfat_unhash_inode(new_inode); -- 2.25.1