From patchwork Wed Dec 10 20:51:35 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: mwilck@arcor.de X-Patchwork-Id: 5472431 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 4521F9F444 for ; Wed, 10 Dec 2014 21:05:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5D4FA201B9 for ; Wed, 10 Dec 2014 21:05:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 78BEF201B4 for ; Wed, 10 Dec 2014 21:05:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933343AbaLJVFr (ORCPT ); Wed, 10 Dec 2014 16:05:47 -0500 Received: from mail-in-16.arcor-online.net ([151.189.21.56]:36436 "EHLO mail-in-16.arcor-online.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933302AbaLJVFl (ORCPT ); Wed, 10 Dec 2014 16:05:41 -0500 Received: from mail-in-02-z2.arcor-online.net (mail-in-02-z2.arcor-online.net [151.189.8.14]) by mx.arcor.de (Postfix) with ESMTP id 7AF36878C for ; Wed, 10 Dec 2014 22:05:40 +0100 (CET) Received: from mail-in-10.arcor-online.net (mail-in-10.arcor-online.net [151.189.21.50]) by mail-in-02-z2.arcor-online.net (Postfix) with ESMTP id 6538A719248; Wed, 10 Dec 2014 22:05:40 +0100 (CET) X-Greylist: Passed host: 188.96.131.100 X-DKIM: Sendmail DKIM Filter v2.8.2 mail-in-10.arcor-online.net 48F3E2D6538 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arcor.de; s=mail-in; t=1418245540; bh=w8Pg2/gFR88+TuagQXbbxlg7R31jwW5WmwPg1OxXok0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=hyPmDELcf/8fwVITXqCfzFzxFQ0zsOo9h9/946MsYxStlEs0Kej58jmkvJeBZrzGv vo9voWNDNzxh2sZi2QSJNp+Q92lUWbvI1Itq6Tro5yVKPTQVz+4LCea+CqEOvFYASe Va2Gzez+td+ip4fh4W9rWChlMIAfrPp1IhYZl0+k= X-Greylist: Passed host: 188.96.131.100 Received: from localhost.localdomain (dslb-188-096-131-100.188.096.pools.vodafone-ip.de [188.96.131.100]) (Authenticated sender: mwilck@arcor.de) by mail-in-10.arcor-online.net (Postfix) with ESMTPSA id 48F3E2D6538; Wed, 10 Dec 2014 22:05:40 +0100 (CET) From: mwilck@arcor.de To: linux-btrfs@vger.kernel.org Cc: mwilck@arcor.de Subject: [PATCH 05/18] btrfs-progs: ctree.h: fix btrfs_inode_[amc]time Date: Wed, 10 Dec 2014 21:51:35 +0100 Message-Id: <1418244708-7087-6-git-send-email-mwilck@arcor.de> X-Mailer: git-send-email 1.7.3.4 In-Reply-To: <1418244708-7087-1-git-send-email-mwilck@arcor.de> References: <1418244708-7087-1-git-send-email-mwilck@arcor.de> Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, FREEMAIL_FROM,RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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: Martin Wilck make btrfs_inode_[amc]time work like the other btrfs_inode_xxx functions. The current definition appears broken to me; it never returns valid pointer unless an extent buffer address is added. Signed-off-by: Martin Wilck --- ctree.h | 15 +++++++++------ 1 files changed, 9 insertions(+), 6 deletions(-) diff --git a/ctree.h b/ctree.h index 89036de..1d5a5fc 100644 --- a/ctree.h +++ b/ctree.h @@ -1414,27 +1414,30 @@ BTRFS_SETGET_STACK_FUNCS(stack_inode_flags, struct btrfs_inode_item, flags, 64); static inline struct btrfs_timespec * -btrfs_inode_atime(struct btrfs_inode_item *inode_item) +btrfs_inode_atime(struct extent_buffer *eb, + struct btrfs_inode_item *inode_item) { unsigned long ptr = (unsigned long)inode_item; ptr += offsetof(struct btrfs_inode_item, atime); - return (struct btrfs_timespec *)ptr; + return (struct btrfs_timespec *)(ptr + eb->data); } static inline struct btrfs_timespec * -btrfs_inode_mtime(struct btrfs_inode_item *inode_item) +btrfs_inode_mtime(struct extent_buffer *eb, + struct btrfs_inode_item *inode_item) { unsigned long ptr = (unsigned long)inode_item; ptr += offsetof(struct btrfs_inode_item, mtime); - return (struct btrfs_timespec *)ptr; + return (struct btrfs_timespec *)(ptr + eb->data); } static inline struct btrfs_timespec * -btrfs_inode_ctime(struct btrfs_inode_item *inode_item) +btrfs_inode_ctime(struct extent_buffer *eb, + struct btrfs_inode_item *inode_item) { unsigned long ptr = (unsigned long)inode_item; ptr += offsetof(struct btrfs_inode_item, ctime); - return (struct btrfs_timespec *)ptr; + return (struct btrfs_timespec *)(ptr + eb->data); } static inline struct btrfs_timespec *