From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 34431C32750 for ; Wed, 31 Jul 2019 00:08:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F21F6206E0 for ; Wed, 31 Jul 2019 00:08:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="hWYJ5Hsw" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728254AbfGaAIn (ORCPT ); Tue, 30 Jul 2019 20:08:43 -0400 Received: from mail-io1-f66.google.com ([209.85.166.66]:35307 "EHLO mail-io1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726167AbfGaAIn (ORCPT ); Tue, 30 Jul 2019 20:08:43 -0400 Received: by mail-io1-f66.google.com with SMTP id m24so132349657ioo.2; Tue, 30 Jul 2019 17:08:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=8JheWTgIzFxYJeqUL2EvPnkBwvWfIxP2sSvvMHXbZc4=; b=hWYJ5Hswuxo5q6pljdWc5Msm3VQGPE+o0HSCQmzoXmEPpO4Z+T78LSXBhG2RqlKjA5 uuHQ1vElZ+CI1PYhfIjSjVmxF+yXKi/O93nZMTrtRa0m21fyg2+JGse6k3wFoGXup9lP bNxdr5XyabSWOxZ8nS3tsaecozIcnxczcu71Ko1/opKV8LhMDy/bdSgSXTlDA6nVnGe/ WJDgjLIInCFxEFkHKUpjj3ok4lp9ISYt3dlugX7qNuFCQQ4EvmiL+mkFCY/ZEY+MfL+y CacADCQ3DvEVeKzsAjzKyhLQ216WFCimRRRaOv5irGoCAMZUXg8xpKt9CYWu6jV/L5OK Iadg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=8JheWTgIzFxYJeqUL2EvPnkBwvWfIxP2sSvvMHXbZc4=; b=YPMXIndRAYkPai/IeGW/4ViNay9s5d6hU17PzNTvrp07FPSTH7GSz841HqLCl6La47 ITTJcWpd5lGaJcu/S4iN+QoEvVbpddNvcIrRwPRYqgBZinmEm3twn0PlWWQmjZpSIOzD 4Pes2tKRiTKXphDcjskJfW2l28G6K+meMd1gRoMFEyJkETqoFIPxV6wOq3dRCqalbtI6 0WHe/ogbpj8x72XKqngujalUAtSIciGpxZgvVUeSkx4gSbfSnDm0A0u2KEr8DnwfPdaz vsWvlKkhf4dJaJYSzgXv2erpcR1tRRAh6u62MigGK/XGLrXgWbzJ5e8XqmfIgu6hUYwF F7+A== X-Gm-Message-State: APjAAAXbkkTV/LD4MZ5NAQpgRBHiQwRuMzM/1Ox/6ROVJxRhd++W4eMU 0dfYza7JiUrbqVTiWbhUT82cpaxi+ENM5hkTlyU= X-Google-Smtp-Source: APXvYqw7z/G000E74naYRSALQNnmNRrw0cRjYs2C5wAzrF9FiInot9iHNesX21g3d95n0NHpLL9UMtgt3fxiJGInFeE= X-Received: by 2002:a6b:f406:: with SMTP id i6mr38634089iog.110.1564531722141; Tue, 30 Jul 2019 17:08:42 -0700 (PDT) MIME-Version: 1.0 References: <20190730014924.2193-1-deepa.kernel@gmail.com> <20190730014924.2193-4-deepa.kernel@gmail.com> <87d0hsapwr.fsf@mail.parknet.co.jp> <5340224D-5625-48A6-909E-70B24D2084BC@tuxera.com> In-Reply-To: <5340224D-5625-48A6-909E-70B24D2084BC@tuxera.com> From: Deepa Dinamani Date: Tue, 30 Jul 2019 17:08:30 -0700 Message-ID: Subject: Re: [PATCH 03/20] timestamp_truncate: Replace users of timespec64_trunc To: Anton Altaparmakov Cc: OGAWA Hirofumi , Alexander Viro , Linux Kernel Mailing List , Linux FS-devel Mailing List , Arnd Bergmann , y2038 Mailman List , Adrian Hunter , Artem Bityutskiy , Greg KH , stoph Hellwig , Jaegeuk Kim , Joel Becker , Richard Weinberger , Tejun Heo , "yuchao0@huawei.com" , "Linux F2FS DEV, Mailing List" , "linux-ntfs-dev@lists.sourceforge.net" , linux-mtd Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 30, 2019 at 3:28 PM Anton Altaparmakov wrote= : > > Hi Deepa, > > > On 30 Jul 2019, at 18:26, Deepa Dinamani wrote= : > > > > On Tue, Jul 30, 2019 at 1:27 AM OGAWA Hirofumi > > wrote: > >> > >> Deepa Dinamani writes: > >> > >>> diff --git a/fs/fat/misc.c b/fs/fat/misc.c > >>> index 1e08bd54c5fb..53bb7c6bf993 100644 > >>> --- a/fs/fat/misc.c > >>> +++ b/fs/fat/misc.c > >>> @@ -307,8 +307,9 @@ int fat_truncate_time(struct inode *inode, struct= timespec64 *now, int flags) > >>> inode->i_atime =3D (struct timespec64){ seconds, 0 }; > >>> } > >>> if (flags & S_CTIME) { > >>> - if (sbi->options.isvfat) > >>> - inode->i_ctime =3D timespec64_trunc(*now, 10000= 000); > >>> + if (sbi->options.isvfat) { > >>> + inode->i_ctime =3D timestamp_truncate(*now, ino= de); > >>> + } > >>> else > >>> inode->i_ctime =3D fat_timespec64_trunc_2secs(*n= ow); > >>> } > >> > >> Looks like broken. It changed to sb->s_time_gran from 10000000, and > >> changed coding style. > > > > This is using a new api: timestamp_truncate(). granularity is gotten > > by inode->sb->s_time_gran. See Patch [2/20]: > > https://lkml.org/lkml/2019/7/29/1853 > > > > So this is not broken if fat is filling in the right granularity in the= sb. > > It is broken for FAT because FAT has different granularities for differen= t timestamps so it cannot put the correct value in the sb as that only allo= ws one granularity. Your patch is totally broken for fat as it would be im= mediately obvious if you spent a few minutes looking at the code... It seemed to me that FAT had already covered the special cases (2s and 1d) granularities by using internal functions. This one could also be an inlined calculation, but I will just drop the FAT part from this patch and leave it as is for now. Thanks, Deepa