Skip to contentSkip to conversation

s390x: fix condition to choose correct function

PATCH In review Steve French 3 participants 6 messages Mar 1, 2016 3 messages not in the archive

Subsystems (4)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 1/3 s390x: fix condition to choose correct function

From: Yadan Fan <ydfan-IBi9RG/[email protected]>

This issue is involved from commit 02323db17e3a7 ("cifs: fix cifs_uniqueid_to_ino_t not to ever return 0"), when BITS_PER_LONG is 64 on s390x, the corresponding cifs_uniqueid_to_ino_t() function will cast 64-bit fileid to 32-bit by using (ino_t)fileid, because ino_t (typdefed __kernel_ino_t) is int type.

---
 fs/cifs/cifsfs.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/cifs/cifsfs.h +1 -1
index 68c4547..02dcbe1 100644
@@ -31,7 +31,7 @@
  * so that it will fit. We use hash_64 to convert the value to 31 bits, and
  * then add 1, to ensure that we don't end up with a 0 as the value.
  */
-#if BITS_PER_LONG == 64
+#if BITS_PER_LONG == 64 && !defined(CONFIG_S390)
 static inline ino_t
 cifs_uniqueid_to_ino_t(u64 fileid)
 {
Signature · 1 line
1.9.1

A message that is not in the archive (sent off-list or not yet received): 1456790652-92638-1-git-send-email-smfrench-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#3 lore raw

Yadan,
I updated the patch to fix whitespace problems and made trivial changes to commit description. Would you doublecheck that it is what you want?

Patch is merged into cifs-2.6.git

Quoted 31 lines · Steve French

From: Yadan Fan <ydfan-IBi9RG/[email protected]>

This issue is involved from commit 02323db17e3a7 ("cifs: fix cifs_uniqueid_to_ino_t not to ever return 0"), when BITS_PER_LONG is 64 on s390x, the corresponding cifs_uniqueid_to_ino_t() function will cast 64-bit fileid to 32-bit by using (ino_t)fileid, because ino_t (typdefed __kernel_ino_t) is int type.

---
 fs/cifs/cifsfs.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/cifs/cifsfs.h +1 -2
index 68c4547..02dcbe1 100644
@@ -31,7 +31,7 @@
  * so that it will fit. We use hash_64 to convert the value to 31 bits, and
  * then add 1, to ensure that we don't end up with a 0 as the value.
  */
-#if BITS_PER_LONG == 64
+#if BITS_PER_LONG == 64 && !defined(CONFIG_S390)
 static inline ino_t
 cifs_uniqueid_to_ino_t(u64 fileid)
 {
--

1.9.1

Signature · 3 lines
Thanks,

Steve
#4 lore raw

Ignore the last one I sent - it was the wrong one. The correct version (the one I merged into cifs-2.6.git) is attached.

Quoted 46 lines · Steve French

Yadan,
I updated the patch to fix whitespace problems and made trivial changes to commit description. Would you doublecheck that it is what you want?

Patch is merged into cifs-2.6.git

Quoted 29 lines · Steve French

From: Yadan Fan <[email protected]>

This issue is involved from commit 02323db17e3a7 ("cifs: fix cifs_uniqueid_to_ino_t not to ever return 0"), when BITS_PER_LONG is 64 on s390x, the corresponding cifs_uniqueid_to_ino_t() function will cast 64-bit fileid to 32-bit by using (ino_t)fileid, because ino_t (typdefed __kernel_ino_t) is int type.

---
 fs/cifs/cifsfs.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/cifs/cifsfs.h +1 -2
index 68c4547..02dcbe1 100644
@@ -31,7 +31,7 @@
  * so that it will fit. We use hash_64 to convert the value to 31 bits, and
  * then add 1, to ensure that we don't end up with a 0 as the value.
  */
-#if BITS_PER_LONG == 64
+#if BITS_PER_LONG == 64 && !defined(CONFIG_S390)
 static inline ino_t
 cifs_uniqueid_to_ino_t(u64 fileid)
 {
--
Quoted 2 lines

1.9.1

--
Thanks,

Steve

Signature · 3 lines
Thanks,

Steve

From 1ee9f4bd1a97026a7b2d7ae9f1f74b45680d0003 Mon Sep 17 00:00:00 2001
From: Yadan Fan <[email protected]>
Date: Mon, 29 Feb 2016 14:44:57 +0800
Subject: [PATCH 1/2] Fix cifs_uniqueid_to_ino_t() function for s390x

This issue is caused by commit 02323db17e3a7 ("cifs: fix cifs_uniqueid_to_ino_t not to ever return 0"), when BITS_PER_LONG is 64 on s390x, the corresponding cifs_uniqueid_to_ino_t() function will cast 64-bit fileid to 32-bit by using (ino_t)fileid, because ino_t (typdefed __kernel_ino_t) is int type.

It's defined in arch/s390/include/uapi/asm/posix_types.h

    #ifndef __s390x__

    typedef unsigned long   __kernel_ino_t;
    ...
    #else /* __s390x__ */

    typedef unsigned int    __kernel_ino_t;

So the #ifdef condition is wrong for s390x, we can just still use one cifs_uniqueid_to_ino_t() function with comparing sizeof(ino_t) and sizeof(u64) to choose the correct execution accordingly.

---
 fs/cifs/cifsfs.h | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)
fs/cifs/cifsfs.h +4 -8
index 68c4547..83aac8b 100644
@@ -31,19 +31,15 @@
  * so that it will fit. We use hash_64 to convert the value to 31 bits, and
  * then add 1, to ensure that we don't end up with a 0 as the value.
  */
-#if BITS_PER_LONG == 64
 static inline ino_t
 cifs_uniqueid_to_ino_t(u64 fileid)
 {
+	if ((sizeof(ino_t)) < (sizeof(u64)))
+		return (ino_t)hash_64(fileid, (sizeof(ino_t) * 8) - 1) + 1;
+
 	return (ino_t)fileid;
+
 }
-#else
-static inline ino_t
-cifs_uniqueid_to_ino_t(u64 fileid)
-{
-	return (ino_t)hash_64(fileid, (sizeof(ino_t) * 8) - 1) + 1;
-}
-#endif
 
 extern struct file_system_type cifs_fs_type;
 extern const struct address_space_operations cifs_addr_ops;
Signature · 1 line
1.9.1
#5 lore raw

PATCH 2/2 CIFS: Fix duplicate line introduced by clone_file_range patch

In reply to a message not in the archive

Commit 04b38d601239b4 ("vfs: pull btrfs clone API to vfs layer") added a duplicated line (in cifsfs.c) which causes a sparse compile warning.

---
 fs/cifs/cifsfs.c | 1 -
 1 file changed, 1 deletion(-)
fs/cifs/cifsfs.c +0 -1
index c48ca13..2eea403 100644
@@ -1013,7 +1013,6 @@ const struct file_operations cifs_file_strict_ops = {
 	.llseek = cifs_llseek,
 	.unlocked_ioctl	= cifs_ioctl,
 	.clone_file_range = cifs_clone_file_range,
-	.clone_file_range = cifs_clone_file_range,
 	.setlease = cifs_setlease,
 	.fallocate = cifs_fallocate,
 };
Signature · 1 line
1.9.1

A message that is not in the archive (sent off-list or not yet received): 1456791058-92940-1-git-send-email-smfrench-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

Applied
#7 lore raw

PATCH 2/2 CIFS: Fix duplicate line introduced by clone_file_range patch

Merged into cifs-2.6.git

---------- Forwarded message ----------
From: Steve French <[email protected]>
Date: Mon, Feb 29, 2016 at 6:10 PM
Subject: [PATCH 2/2] CIFS: Fix duplicate line introduced by
clone_file_range patch
To: [email protected]
Cc: Steve French <[email protected]>, Steve French <steve.french-7I+n7zu2hftEKMMhf/[email protected]>, Christoph Hellwig <[email protected]>

Commit 04b38d601239b4 ("vfs: pull btrfs clone API to vfs layer") added a duplicated line (in cifsfs.c) which causes a sparse compile warning.

---
 fs/cifs/cifsfs.c | 1 -
 1 file changed, 1 deletion(-)
fs/cifs/cifsfs.c +0 -1
index c48ca13..2eea403 100644
@@ -1013,7 +1013,6 @@ const struct file_operations cifs_file_strict_ops = {
        .llseek = cifs_llseek,
        .unlocked_ioctl = cifs_ioctl,
        .clone_file_range = cifs_clone_file_range,
-       .clone_file_range = cifs_clone_file_range,
        .setlease = cifs_setlease,
        .fallocate = cifs_fallocate,
 };

--
1.9.1

Signature · 3 lines
Thanks,

Steve
Reviewed-by
#8 lore raw

Re: [PATCH 2/2] CIFS: Fix duplicate line introduced by clone_file_range patch

In reply to a message not in the archive
Quoted 6 lines · Steve French

Commit 04b38d601239b4 ("vfs: pull btrfs clone API to vfs layer") added a duplicated line (in cifsfs.c) which causes a sparse compile warning.

Oops. The fix looks fine to me: