Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp4765341pxb; Tue, 5 Oct 2021 09:51:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwRCwV7/dt/rztZGCX/XUuydZvY/qlzfqnWZ32lHeFYiEiMm5zMkCkojgV/Qmk56lVsPX/s X-Received: by 2002:a50:ec08:: with SMTP id g8mr23979893edr.303.1633452680297; Tue, 05 Oct 2021 09:51:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633452680; cv=none; d=google.com; s=arc-20160816; b=BoBOWHWrF3tvHkiIv2dXurShvw4YVkle34wl3w+WJbjT5nzhuUiZR5zh9Uhx0pV2Xm kelhQsiABAU3afYbi6x+GB3n5WCOfwoIVRcROFZ9fPvMb/1+HBUvk15+rPTgKUSABpk0 ogUoGfvpsR2K1IxWHwk/BBEj13qtpK8hLnRukzSP7DpEDESGBfYSIgNc3hJGWy5CqB6H wOB3WAbkeVQsQj3nQAjnHURrVPnZoCIiiCLW6xjRjXMIfEQ6y7r7XflKe1gyAl03oI8O 0cwP0F7VG4U/Fd02c+A0VjVAo4ztBdWRfxcIpTE9BsXXqpz4mp0DjQ+WtVr/E/K8mrwx 3FVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:references :cc:to:from:content-language:subject:user-agent:mime-version:date :message-id:dkim-signature; bh=Zre4cSfIxDvE43kuIW5Oeh8hW2AAvbtXh8IQ7/+ZDcs=; b=bl6vB+Tb9UQaTCvJs8zX2G8QywmEXCWhi6twDsv5m/5W3wH/KTlO0r6dZWCdtAeZcZ PNeotyCRhzHGth1uRSo0/9sRdk69a0vDXxt1IovfOp1tQ+QulJ9EM04tmdHQjdb4mdzE /TdkbYXgi1OvN08pyAuq1d4vbi+VKf2CnUbOj4zx3hhfplhzyCX2AudVUFxKZNOZSvxL K/KqMPLhHUUy/Q0L75yQsn09GmXLVPuKt19/s7Dic8NudfNr28twc99tHgJKW2e8+qnm cLGs9pQ9YgqPBcFZR53CUhZ3XCJ9D3+S9+qs6rSk7QqQCEpYKcvVfAVP60YM11GBRgje dMxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@paragon-software.com header.s=mail header.b=UYuie3A7; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=paragon-software.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f20si5602220ejk.645.2021.10.05.09.50.52; Tue, 05 Oct 2021 09:51:20 -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=@paragon-software.com header.s=mail header.b=UYuie3A7; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=paragon-software.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236700AbhJEQuX (ORCPT + 99 others); Tue, 5 Oct 2021 12:50:23 -0400 Received: from relaydlg-01.paragon-software.com ([81.5.88.159]:49357 "EHLO relaydlg-01.paragon-software.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236600AbhJEQuW (ORCPT ); Tue, 5 Oct 2021 12:50:22 -0400 Received: from dlg2.mail.paragon-software.com (vdlg-exch-02.paragon-software.com [172.30.1.105]) by relaydlg-01.paragon-software.com (Postfix) with ESMTPS id A5F4681FEE; Tue, 5 Oct 2021 19:48:30 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1633452510; bh=Zre4cSfIxDvE43kuIW5Oeh8hW2AAvbtXh8IQ7/+ZDcs=; h=Date:Subject:From:To:CC:References:In-Reply-To; b=UYuie3A7wmuGhbI41tthfPTda1G616JH5ZT6R5rpmokX9evrCztGcEtqNOPcMrN2a hZlhVFA0ZVtO4qXxifBW5OGdGbpYQVjUwTRwO94WrNCy0KN+LxFwcftvaTkCImExaO 4rUG+gweNN+FY5z/PEoNfOYpOf66LTrzxKeXEdS0= Received: from [192.168.211.181] (192.168.211.181) by vdlg-exch-02.paragon-software.com (172.30.1.105) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Tue, 5 Oct 2021 19:48:30 +0300 Message-ID: <0310433c-d9dc-da5b-f642-2ad4298a8918@paragon-software.com> Date: Tue, 5 Oct 2021 19:48:29 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.1.2 Subject: [PATCH 5/5] fs/ntfs3: Refactor ntfs_read_mft Content-Language: en-US From: Konstantin Komarov To: CC: , References: <98a166e4-f894-8bff-9479-05ef5435f1ed@paragon-software.com> In-Reply-To: <98a166e4-f894-8bff-9479-05ef5435f1ed@paragon-software.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [192.168.211.181] X-ClientProxiedBy: vobn-exch-01.paragon-software.com (172.30.72.13) To vdlg-exch-02.paragon-software.com (172.30.1.105) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [PATCH 5/5] fs/ntfs3: Refactor ntfs_read_mft Don't save size of attribute reparse point as size of symlink. Signed-off-by: Konstantin Komarov --- fs/ntfs3/inode.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/fs/ntfs3/inode.c b/fs/ntfs3/inode.c index bdebbbd53e76..859951d785cb 100644 --- a/fs/ntfs3/inode.c +++ b/fs/ntfs3/inode.c @@ -222,9 +222,6 @@ static struct inode *ntfs_read_mft(struct inode *inode, if (!attr->non_res) { ni->i_valid = inode->i_size = rsize; inode_set_bytes(inode, rsize); - t32 = asize; - } else { - t32 = le16_to_cpu(attr->nres.run_off); } mode = S_IFREG | (0777 & sbi->options->fs_fmask_inv); @@ -313,17 +310,14 @@ static struct inode *ntfs_read_mft(struct inode *inode, rp_fa = ni_parse_reparse(ni, attr, &rp); switch (rp_fa) { case REPARSE_LINK: - if (!attr->non_res) { - inode->i_size = rsize; - inode_set_bytes(inode, rsize); - t32 = asize; - } else { - inode->i_size = - le64_to_cpu(attr->nres.data_size); - t32 = le16_to_cpu(attr->nres.run_off); - } + /* + * Normal symlink. + * Assume one unicode symbol == one utf8. + */ + inode->i_size = le16_to_cpu(rp.SymbolicLinkReparseBuffer + .PrintNameLength) / + sizeof(u16); - /* Looks like normal symlink. */ ni->i_valid = inode->i_size; /* Clear directory bit. */ @@ -420,7 +414,7 @@ static struct inode *ntfs_read_mft(struct inode *inode, ni->std_fa &= ~FILE_ATTRIBUTE_DIRECTORY; inode->i_op = &ntfs_link_inode_operations; inode->i_fop = NULL; - inode_nohighmem(inode); // ?? + inode_nohighmem(inode); } else if (S_ISREG(mode)) { ni->std_fa &= ~FILE_ATTRIBUTE_DIRECTORY; inode->i_op = &ntfs_file_inode_operations; -- 2.33.0